Hi,
Since you guys are the rewrite kings,Can anyone explain the differences between these two different 301 redirect statements below please. This is only to redirect "domain.com" to "www . domain.com" to consolidate links. They both seem to do the same thing, but the vBSEO folks recommended the first one, and I was using the second one before setting up a forum in a sub-directory of my website, so I'd like to know the differences and if one way is better, etc.
The redirect is in my root dir .htaccess file, and not my in my /forum subdirectory. They both also work fine when accessing the forum with either "forum.domain.com" or "www . domain.com/forum" or "domain.com/forum" so I have not modified my .htaccess file in the /forum directory to do any custom re-writing as far as "www / non-www" stuff goes, so I'll leave that file alone for now.
Here's the two different versions:
RewriteCond %{HTTP_HOST} !^www\.domain\.com
RewriteRule (.*) http://www.domain.com/$1 [R=301,L]
RewriteCond %{http_host} ^domain.com [nc]
RewriteRule ^(.*)$ http://www.domain.com/$1 [R=301,nc]
Which one is preferred? Both the same?
On another different note, when I type: forum.domain.com or domain.com/forum/ (with trailing slash) both of those urls stay the same in the browser heading, and once a click is made on anything, it changes to "www . domain.com/forum" because the url's are already re-written. If I go to domain.com/forum (without the slash) it gets re-written right away to "www . domain.com/forum". I don't think there is any issue with that, since the first two get changed to the preferred format "www.domain.com/forum" once any action is taken by the user, unless you think I should have rewrites for that?
Thanks!



LinkBack URL
About LinkBacks
Can anyone explain the differences between these two different 301 redirect statements below please. This is only to redirect "domain.com" to "www . domain.com" to consolidate links. They both seem to do the same thing, but the vBSEO folks recommended the first one, and I was using the second one before setting up a forum in a sub-directory of my website, so I'd like to know the differences and if one way is better, etc.





Reply With Quote


