Hard .htacess question???

by 2 replies
3
Hi guys,

I'm really having a problem with this htacess file - i'm not geat, and am trying to put it together with code on the web.

I'm trying to make the following happen:

Code:
http://site.com redirect to http://www.site.com
http://www.site.com/folder redirect to http://www.site.com/folder/


AND put it all together as a rewrite redirect to the index...

http://www.site.com// redirect to http://www.site.com/index.php?p=







#programming #hard #htacess #question
  • Question 1 :
    http://site.com redirect to http://www.site.com

    Options +FollowSymLinks
    RewriteEngine on
    RewriteCond %{HTTP_HOST} ^site\.com
    RewriteRule ^(.*)$ http://www.site.com/$1 [R=permanent,L]

    Question 2 :
    http://www.site.com/folder redirect to http://www.site.com/folder/

    RewriteEngine On
    RewriteBase /
    RewriteCond %{REQUEST_FILENAME} !-f
    RewriteCond %{REQUEST_URI} !(.*)/$
    RewriteRule ^(.*)$ http://www.site.com/$1/ [L,R=301]

    Final part :

    RewriteRule ^(.*)/$ http://www.site.com/index.php?p=$1 [L,R=301]

    Hope this helps

    Bruce
    • [ 1 ] Thanks
  • Perfect mate!

    Thanks so much.

Next Topics on Trending Feed