.htaccess
The .htaccess files are Apache configuration files. Here are some examples of how they are most often used.
Protecting a directory with a password
Use an ID and password to protect the access to file for certain users.
The $HOME variable can be used to indicate the root of the account.
The .htpasswd contains the list of Id/password combinations allowed. It can be placed anywhere but it must not be readable from the outside.
To create this .htpasswd file:
Replace [user] with the desired user name. The tool will prompt the user to enter the corresponding password twice.
Restricting access to a directory
Block access to a directory by a domain or an IP address. You can also allow access to the directory only by selected IPs and/or domains.
Customize error messages (403, 404, etc.)
The following syntax will define custom error pages:
This syntax is valid regardless of the HTTP response code.
Redirect
This function is available directly by declaring a Redirect site type, but you can do this using the .htaccess file:
You can also redirect an entire directory as follows:
URL rewriting
URL rewriting comprises changing the link structure. This practice is often used to improve the indexing of your pages (and therefore your site referencing) by inserting keywords into the addresses.
Possible errors
Any error linked to .htaccess will be visible in the $HOME/admin/logs/apache/apache.log file.
The .htaccess file was not saved in the correct format. Please pay attention to saving your file without BOM. This is generally an option in your editor.