4

I am trying to setup a subdomain on a server of mine, where blog.domain.com serves the content from domain.com/blog/

Perhaps this is the wrong way of doing this entirely, but I have setup a blog.domain.com VirtualHost for this, whose DocumentRoot is /path-to-domain.com-root/blog/. However, it seems that the .htaccess file from the original DocumentRoot (i.e. /path-to-domain.com-root/.htaccess) is still being applied even under the new subdomain's VirtualHost.

So, I'm wondering, does Apache look at .htaccess files, even if they're above the DocumentRoot — if so, how can I stop it from doing this (it's rewriting the URL and sending it to somewhere that I don't want it to go)? Or if there's a better way of doing this, I accept that I might be being a complete idiot and doing it totally wrong :)

Thanks

1 Answer 1

3

I suggest you look at the .htaccess files tutorial in the Apache documentation to get an idea of how they are applied.

Basically Apache will walk up the directory tree looking for htaccess files unless you have an AllowOverride None directive in a <Directory> statement.

Edit: Apache will keep going till it hits an AllowOverride None directive for a directory. Most servers come configured with it set for / and whatever the default server root is. This keeps the default configuration from traversing past your web root. However, the default is also None, so I think this must be for clarification purposes only. I suggest you check your default /etc/apache2/httpd.conf file to be sure.

3
  • I did see that, but it doesn't mention where (or if) it stops… will it traverse right up to the root directory?
    – obeattie
    Nov 10, 2009 at 14:06
  • …by which I mean /, not the DocumentRoot.
    – obeattie
    Nov 10, 2009 at 14:07
  • Added some clarification regarding the traversal. Nov 10, 2009 at 17:41

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .