What is the .htaccess File?

On servers that use Apache, a .htaccess file lets you control high-level website configuration without having to edit your server configuration files. You can even apply different settings to different directories by using multiple .htaccess files. You can, theoretically, create a .htaccess file in any directory on your server by creating and uploading a plain text file.

Generally, you want to minimize the number of .htaccess files on your server because too many configurations can slow your server down. When your server sees a .htaccess file in a directory, it looks for .htaccess files in all the parent directories, too, increasing server resource usage. .htaccess files that are higher up in the file path always take precedence.

Apache is configured so all files named .htaccess are hidden. These files have important configuration information and can be used to compromise your server.

The most common uses for .htaccess are:

Using .htaccess files is a powerful tool for managing your server, but it can be tricky. Make sure you are familiar with making changes to your server before you start editing .htaccess files.

Before making any changes to configuration files, we strongly recommend you take a backup of the file.

Have more questions? Submit a request
Powered by Zendesk