.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:
Value | Description |
---|---|
All | All enabled. This is the default value. |
None | Completely disable .htaccess . |
AuthConfig | Authorization directives such as those dealing with Basic Authentication. |
FileInfo | Directives that deal with setting Headers, Error Documents, Cookies, URL Rewriting, and more. |
Indexes | Default directory listing customizations. |
Limit | Control access to pages in a number of different ways. |
Options | Similar 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