|subfolder not being redirected with 301|
| 12:41 am on Feb 8, 2009 (gmt 0)|
So, I'm getting a handle on this redirect thing except for one problem. On one of my sites, I have www.example.com which is using a non-www to www 301 redirect on the main page which is static. It works fine. The problem is that example.com/blog(wordpress) is *not* redirecting to www, at all, and that's by far the most important part of the site. There is an htaccess file in the main site root, and one in the blog root. If I take out the .htaccess file from the blog root the blog simply doesn't work. I've tried rewrite rules, swapping things out, etc and for whatever reason the blog subfolder refuses to redirect to the canonical URL. Here's what I'm getting in the server header checker when I type in "example.com/blog" (it should be redirected to www.example.com/blog):
HTTP/1.1 301 Moved Permanently
Date => Sun, 08 Feb 2009 00:27:44 GMT
Server => Apache/2.2.11 (Unix) mod_ssl/2.2.11 OpenSSL/0.9.8i DAV/2 mod_auth_passthrough/2.1 mod_bwlimited/1.4 FrontPage/22.214.171.12435
Location => http://example.com/blog/
Content-Type => text/html; charset=iso-8859-1
What's strange is it does this without any 301 redirects in either .htaccess file! Do I have a hidden redirect somwhere?
Thanks for any comments.
| 3:08 am on Feb 8, 2009 (gmt 0)|
Either you've got a redirect in your server config file (probably installed using the control-panel, or by the blog software installer), or you forgot to flush your browser cache before testing.
If there is a redirect in the config file, then your root-level /.htaccess file may be bypassed; You might want to duplicate the domain canonicalization redirect in the /blog/.htaccess file, but it sounds like that would result in stacked multiple redirects, and that would not be good.
Or you could try using RewriteOptions inherit in /blog/.htaccess.
| 4:29 am on Feb 8, 2009 (gmt 0)|
Thanks Jim. I did the "inherit" command for the blog .htaccess and when I try to access the blog it redirects me to www.example.com and I can't access www.example.com/blog!
I also tried duplicating rhe canonicalization redirect in the blog htaccess but no luck there either.
No redirects in control panel that I can see.
| 2:18 pm on Mar 1, 2009 (gmt 0)|
Thanks for the help. I was able to solve the issue for anyone else who has this problem. Apparently WP introduced a canonical fix in 2.3 that is automatically enabled. You then set the blog address in the "general" settings page. Mine was set at example.com, which was causing an infinite redirect with my main root .htaccess which was set to www.example.com (where most of my inbound links are). I have 5,000 inbound links on www.example.com, and 3,700 inbound links on example.com, so I made www the canonical.