Why can't I disable .htaccess in Apache?

大憨熊 提交于 2019-12-04 08:59:43

The reason the file is not served via mod_python when you delete .htaccess is because the setup for mod_python is located in it. If you move that stuff to your sites-available file, you can delete .htaccess, turn a blind eye to the problem, and call it a day.

If that doesn't satisfy you, then as to why .htacess is being read at all, I can't say. You are correct that AllowOverride None should prevent the file from ever being read. Have you considered the possibility that you screwed something up when adding the virtual site? Try throwing some garbage into the config and see if it complains, just to be sure it's being read at all.

AllowOverride is only allowed in <Directory>-sections, so you've done everything right.

One problem you could have is that other (sub-)<Directory>-sections set AllowOverride to something different than None. That will override the setting for these subdirectories. I use

<Directory />
    Options FollowSymLinks
    AllowOverride None
</Directory>
<Directory /var/www/>
    Options Indexes FollowSymLinks MultiViews
    AllowOverride AuthConfig 
    Order allow,deny
    allow from all
</Directory>

and in /var/www (my docroot) I can use .htaccesses.

The reason why mod_python does not work anymore if you delete your .htaccess is that mod_python setup is usually in .htaccess files.

If you need more information, please send us your configuration.

PS: In fact the docuementation linked above says that you should never set AllowOverride to something not None in <Directory />.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!