.htaccess tutorial

htaccess Elite


www vs Non-www, Separate Homepage & Blog

Ask your mod_rewrite and Redirection questions here, and get answers!

www vs Non-www, Separate Homepage & Blog

Postby kingofkk » 17 May 2008 10:37

Hi there,

I have a a wordpress blog installed in www.example.com/blog/. When I type www.example.com/blog/ OR example.com/blog/ in my firefox/IE7 address bar, the result will appear as 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 example.com in my firefox/IE7 address bar, it will then appear as example.com . If I type www.example.com, it will then appear to be www.example.com . So this is a non-canonical form of URL ?

I have done some search in some other forums, and came out with several 301 redirect results, but I am not sure which to use.

Code: Select all
Options +Indexes
Options +FollowSymlinks
RewriteEngine on
RewriteBase /
RewriteRule ^whatever/(.*)$ http://www.domain.com/$1/ [R=301,L]


This is the 301 redirect code that I've came up with.

Question 1 : Should I use this code to re-direct my homepage URL ?

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 www.example.com/blog/ ?
kingofkk
 
Posts: 1
Joined: 14 May 2008 15:38

Return to Redirect or Rewrite Questions