What is the htaccess file and what is it for?
What is a .htaccess file
The .htaccess file is an ASCII file that you can create with any text editor, such as Notepad or TextEdit. Configure the Apache directives that the server should use in each directory hierarchically: if you place it inside /public_html, it will affect all subdirectories as well.
Note that .htaccess is the full name of the file, with the period included at the beginning.
Directives can be overridden: if you create a second .htaccess within a subdirectory, it will take priority at that level and below.
What can be done with .htaccess
With the .htaccess file you can do many things, for example:
- Redirect the user to a different web page
- Password protect some directory
- Block users by IP
- Avoid “hot-linking” of your images
- Rewrite URLs
- Specify your own error pages
- Force the user to use secure https protocol
Recommended readings
Still need help?
If this guide didn’t solve your issue, our team can help you via ticket.