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] /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 and AllowOverride are both set to None, 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 just AllowOverrideList 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 your AllowOverrideList statement in the main Apache config:

AllowOverride Limit

Your needs may vary and it's up to you to evaluate the security implications of the above.

  • Confirmed: if a virtualhost has AllowOverride None and AllowOverrideList RewriteEngine etc…, and .htaccess file contains <IfModule> … </IfModule>, it will result in an error 500, “IfModule not allowed here”. The docs say directives such as IfModule are allowed in any .htaccess file, as long as overrides are enabled in the server configuration, which is not true or very confusing, because an override is enabled in AllowOverrideList. 🤥 Adding AllowOverride Limit does solve it, so thanks for the tip! – Quinn Comendant May 29 '20 at 0:11

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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