Forum Moderators: phranque

Message Too Old, No Replies

Mod re_write diff between this and this?

What is the exact difference between these two in their function? results?

         

theblade24

12:39 pm on May 18, 2006 (gmt 0)

10+ Year Member



What is the exact difference between these two in their function? results?

Is one better than another?

RewriteCond %{HTTP_HOST}!^www\.sitename\.com [NC]
RewriteRule ^(.*)$ [sitename.com...] [R=301,L]

RewriteCond %{HTTP_HOST} ^sitename\.com [NC]
RewriteRule ^(.*) [sitename.com...] [R=301,L]

Also, is it wise to redirect /index.html to /?

jdMorgan

9:29 pm on May 18, 2006 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



The difference is that one redirects requests for a specific non-canonical domain to the canonical domain, while the other redirects requests for any domains that are not the canonical domain to the canonical domain. See any regular-expressions tutorial to understand how the patterns differ.

I never link to /index.html, /main.htm, default.shtml, or /index.php, and always install a redirect to correct any attempt by other sites to do so, just as I do for non-canonical domain requests. An ounce of prevention on a new site is easily worth a pound of cure.

Jim