I'm working in a hosted situation where I have a primary webroot located in ~/www
. I have several subdomains hosted in ~/www/__subdomains
. In the primary webroot, I have a .htaccess
file that does a bit of minor rewriting. In two of my subdomains, I have similar .htaccess
files and these subdomains respond properly.
In 2 other, newly created subdomains, I have .htaccess
files that are empty save for an AddHandler
directive. What I'm finding is that the root .htaccess
file's existence/content affects these 2 subdomains. They throw a 500 error. As soon as I rename that one, the broken subdomains work.
This, of course, breaks the other sites so I can't just move this off, but it violates my understanding of how .htaccess
recursion works. I thought that as long as there was a .htaccess
file in a subdirectory, those in ancestor directories would never get executed.
Clearly, I'm wrong about that so I'm hoping someone can educate me and help me get this fixed.
Thanks.
.htaccess
files are applied from the current directory up, stopping at the main configuration. Any rules and directives that are in the current directory's .htaccess
file, supersede any other rules found while evaluating .htaccess
further up.
However, the problem, as you've found, is that rules that aren't explicitly overridden, are applied from the other files. You can reference the Apache .htaccess Tutorial for further explanation, specifically, the How directives are applied section.
Hope that helps.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With