开发者

How does htaccess recursion work?

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 violat开发者_C百科es 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.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜