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

obeattie
  • 304
  • 1
  • 6
  • 13

1 Answers1

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.

Kamil Kisiel
  • 12,184
  • 7
  • 48
  • 69