Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

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

share|improve this question
add comment

1 Answer

up vote 2 down vote accepted

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.

share|improve this answer
    
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 '09 at 14:06
    
…by which I mean /, not the DocumentRoot. –  obeattie Nov 10 '09 at 14:07
    
Added some clarification regarding the traversal. –  Kamil Kisiel Nov 10 '09 at 17:41
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.