Skip to main content

.htaccess Enable .htaccess

Enable .htaccess

.htaccess files are normally enabled by default. This is controlled by AllowOverride directive in the httpd.conf file. This directive can only be placed inside of a <Directory> section.

<Directory "/var/www">
AllowOverride All
</Directory>

There are numerous values that limit configuration of only certain contexts. Some of them are:

ValueDescription
AllAll enabled. This is the default value.
NoneCompletely disable .htaccess.
AuthConfigAuthorization directives such as those dealing with Basic Authentication.
FileInfoDirectives that deal with setting Headers, Error Documents, Cookies, URL Rewriting, and more.
IndexesDefault directory listing customizations.
LimitControl access to pages in a number of different ways.
OptionsSimilar access to Indexes but includes even more values such as ExecCGI, FollowSymLinks, Includes and more.
note

Make sure to always make a backup of your httpd.conf and .htaccess files before you make a change.

Sometimes even a single error in your httpd.conf or .htaccess s file will result in a temporary meltdown of the server, and users will see 500 - Internal Server Error page.

For example:

# Only allow .htaccess files to override Authorization and Indexes
AllowOverride AuthConfig Indexes

Table of Contents