I was trying to configure my server with htaccess to force the “www”. Now, I know there’s a whole cult out there for “No WWW”, but I’m happy to leave it there, that’s where my links go to and it’s not a big deal to me.
So anyway, I had my htaccess file configured like so:
RewriteCond %{HTTP_HOST} !^www\.
RewriteRule (.*) http://www.%{HTTP_HOST}/$1 [R=301,L]
Simple enough, right?
But it was doing some strange things. When you go to:
http://www.mysite.com/forum
you get redirected to:
http://www.mysite.com/forum/
(Adds trailing slash)
When you go to:
http://mysite.com/forum/
you get redirected to:
http://www.mysite.com/forum/
(Adds www)
BUT! When you go to:
http://mysite.com/forum
you get redirected to:
http://www.mysite.com/forum//home/mysite/www/forum/
(The local path added to the end)
Bizarre…I couldn’t work out what was happening! I tried about 15 different pieces of htaccess code and none fixed the problem.
Then I worked it out. I had another .htaccess file in my /forum/ folder, which was redirecting incorrectly. I deleted the file and it fixed the problem.
What a waste of 30 minutes!
November 9th, 2007
bbcentral
Posted in
Tags: 

Adelaide, Australia