In my Apache virtual host config file, I am using AllowOverrideList. I am using the default of AllowOverride None
because I only want to enable specific directives in .htaccess, not groups of directives.
However, I am getting an HTTP 500 error code, with this in the error log:
[Tue May 09 10:16:03.271831 2017] [core:alert] [pid 16415] [client 196.52.43.51:42111] /var/www/xyz/.htaccess: <Files not allowed here
The first thing in the .htaccess file is a properly-formed <Files>
section. This shouldn't be causing a problem, because it's more of a "meta directive" that's used to contain other directives.
If
AllowOverrideList
andAllowOverride
are both set toNone
, then .htaccess won't be loaded at all. However, it turns out that there is some kind of Apache bug in which .htaccess is loaded but not processed properly -- causing errors -- if justAllowOverrideList
but not AllowOverride is used in the main Apache config.To fix the problem and get
<Files>
or one of the other sections to work in .htaccess, add this in addition to yourAllowOverrideList
statement in the main Apache config:Your needs may vary and it's up to you to evaluate the security implications of the above.