Hi there, I have a a wordpress blog installed in http://www.example.com/blog/. When I type http://www.example.com/blog/ OR http://example.com/blog/ in my firefox/IE7 address bar, the result will appear as http://www.example/com/blog/. I believe this is what they call , a canonical form of URL (please correct me if I am wrong). For my homepage, when I type http://example.com/ in my firefox/IE7 address bar, it will then appear as http://example.com/ . If I type http://www.example.com/ , it will then appear to be http://www.example.com/ . So this is a non-canonical form of URL ? I have done some search in DP forum, and came out with several 301 redirect results, but I am not sure which to use. Options +Indexes Options +FollowSymlinks RewriteEngine on RewriteBase / RewriteRule ^whatever/(.*)$ http://www.domain.com/$1/ [R=301,L] Code (markup): This is the 301 redirect code that I've came up with. Question 1 : Should I use this code in my root folder's .htaccess file ? Question 2 : If I have decided to add the code above, into my root folder's .htaccess file, will it affect my wordpress blog which was being installed in http://www.example.com/blog/ ?
The code goes in your root htaccess file. Make a back up copy of the one currently on your server and if you have any problems, it will take a few seconds to replace the backup copy. RewriteEngine On RewriteCond %{HTTP_HOST} ^domain\.com$ [NC] RewriteRule ^(.*)$ http://www.domain.com/$1 [R=301,L] (this is assuming you want the www.domain.com to always show)
Thanks mjewel . But do I need to add these before the RewriteEngine On code ? [Options +Indexes Options +FollowSymlinks]
You shouldn't need to add them, but it really depends on your sever configuration. Just try it without it.