Habbakuk
08-22-2011, 03:58 AM
I'm trying to redirect from my non-www homepage to my www homepage. Should be simple, but after dozens of tries, and asking on several forums, including the forum of the website system I use (zen-cart) nothing has of yet worked.
I've tried every permutation of the redirect I could find.
RewriteEngine On
RewriteBase /
RewriteCond %{HTTP_HOST} .
RewriteCond %{HTTP_HOST} !^www\.oldewatches\.com
RewriteRule (.*) http://www.oldewatches.com/$1 [R=301,L]
RewriteEngine On
RewriteBase /
RewriteCond %{HTTP_HOST} !^www\.oldewatches\.com
RewriteRule ^(.*)$ http://www.oldewatches.com/$1 [R=301,L]
RewriteEngine On
RewriteBase /
RewriteCond %{HTTP_HOST} ^oldewatches.com [NC]
RewriteRule (.*) http://www.oldewatches.com/$1 [L,R=301]
etc.
Nothing works. What is odd is when I add the code:
RewriteCond %{THE_REQUEST} ^[A-Z]{3,9}\ /.*index\.html\ HTTP/
RewriteRule ^(.*)index\.html$ http://www.oldewatches.com/$1 [R=301,L]
http://www.oldewatches.com/index.html WILL redirect to http://www.oldewatches.com but if it is http://oldewatches.com/index.html (without www) it will redirect to http://oldewatches.com, also without www.
I asked another web designer about this and he said even with the redirect on from non-www to www, it won't show up in the browser. He didn't explain why. I know it isn't browser-related since other websites with redirects will redirect properly in my browser (Firefox 3.6)
What other reasons could there be for this?
I've tried every permutation of the redirect I could find.
RewriteEngine On
RewriteBase /
RewriteCond %{HTTP_HOST} .
RewriteCond %{HTTP_HOST} !^www\.oldewatches\.com
RewriteRule (.*) http://www.oldewatches.com/$1 [R=301,L]
RewriteEngine On
RewriteBase /
RewriteCond %{HTTP_HOST} !^www\.oldewatches\.com
RewriteRule ^(.*)$ http://www.oldewatches.com/$1 [R=301,L]
RewriteEngine On
RewriteBase /
RewriteCond %{HTTP_HOST} ^oldewatches.com [NC]
RewriteRule (.*) http://www.oldewatches.com/$1 [L,R=301]
etc.
Nothing works. What is odd is when I add the code:
RewriteCond %{THE_REQUEST} ^[A-Z]{3,9}\ /.*index\.html\ HTTP/
RewriteRule ^(.*)index\.html$ http://www.oldewatches.com/$1 [R=301,L]
http://www.oldewatches.com/index.html WILL redirect to http://www.oldewatches.com but if it is http://oldewatches.com/index.html (without www) it will redirect to http://oldewatches.com, also without www.
I asked another web designer about this and he said even with the redirect on from non-www to www, it won't show up in the browser. He didn't explain why. I know it isn't browser-related since other websites with redirects will redirect properly in my browser (Firefox 3.6)
What other reasons could there be for this?