Forum Moderators: phranque

Message Too Old, No Replies

Strange Problem www / non-www

         

lee_sufc

2:02 pm on Jul 25, 2006 (gmt 0)

10+ Year Member Top Contributors Of The Month



A few months back we changed our HT access file to redirect http://example.com to www.example.com - this has all been working fine until i noticed something today:

The redirect doesn't work on http://example.com/blog - it works on /forum and other folders but not the blog.

Does anyone here know why?

This is what we have in our HT access file:

RewriteEngine On
RewriteCond %{HTTP_HOST} ^example\.com [NC]
RewriteRule (.*) http://www.example.com/$1 [R=301,L]

[edited by: trillianjedi at 2:08 pm (utc) on July 25, 2006]
[edit reason]
[1][edit reason] Use example to avoid it getting "linked" [/edit]
[/edit][/1]

trillianjedi

2:13 pm on Jul 25, 2006 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Here's mine which seems to work fine:-

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

TJ

jdMorgan

2:39 pm on Jul 25, 2006 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



It's possible that your blog in hosted in a separate directory from the rest of your aite, and that an Alias [httpd.apache.org] directive is used in httpd.conf (or another config file) to make it appear to be located in the same directory-space.

If this is the case, then an .htaccess file in your regular directory-space will have no effect on the aliased directory-space.

Jim

encyclo

2:43 pm on Jul 25, 2006 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



You may also have a .htaccess file in the /blog directory which interferes with or takes precedence over the one on your document root. WordPress, for example, has its own rewrite rules in a .htaccess.