page content

How to configure Apache using .htaccess files?

The use of .htaccess files allows a website user to apply an Apache server configuration. To accomplish this the user can upload a .htaccess file containing the configuration directives in the directory she wants. This allows for example to configure the rewriting rules for the URL, to define another character set, to create a protected directory, to put into place a redirection, etc.

Parsing .htaccess files is by default deactivated to enhance the speed of the server. If you wish to install certain configurations yourself, we can activate it in the main configuration of your hosting.

There is a lot of information about how to use .htaccess files within Apache.

If your .htaccess files contains a syntax error, it will simply be ignored by the Apache server and you will get a "500 Internal configuration error" in the context visualisation through a browser. In that case you can rename or simply delete the .htaccess file. (Pay extra attention if you work with a MacOS editor to upload your .htaccess files with the UNIX newlines, for example via BBEdit save with UNIX linefeeds.)

Activating .htaccess files is done through the AllowOverride directive in the main configuration file of Apache. If you have Webmin access for managing your site, it can be activated in the Webmin-Apache module. Do the following steps to restrict the use of .htaccess files to a particular Apache virtual host:

After changing these options, don't forget to click the « Apply Changes » link (on the top right) to make the Apache server use your changes.