1: Following is the code to redirect non www domain (http://yoursite.com/) to www domain (http://www.yoursite.com/) permanently (301):
Options +FollowSymLinks
RewriteEngine on
RewriteCond %{HTTP_HOST} ^yoursite\.com
RewriteRule ^(.*)$ http://www.yoursite.com/$1 [R=permanent,L]
2: Following code is to redirect index.html to http://www.yoursite.com/
RewriteCond %{THE_REQUEST} ^[A-Z]{3,9}\ /.*index\.html\ HTTP/
RewriteRule ^(.*)index\.html$ /$1 [R=301,L]
3: Following code is to redirect index.php to http://www.yoursite.com/
RewriteCond %{THE_REQUEST} ^[A-Z]{3,9}\ /.*folder/index\.php\ HTTP/
RewriteRule ^(.*)folder/index\.php$ /folder/$1 [R=301,L]
After creating the .htaccess file we just need to upload it to the root folder of the website.
Read More
No comments:
Post a Comment