.htaccess is a configuration file used by the Apache web server.
What is .htaccess
The .htaccess file is a configuration file from Apache web server. It allows you to write server configuration options on a per-directory basis.
Each .htaccess file has its own set of rules that apply to the directory where the .htaccess file is (and its subfolders).
Uses of .htaccess
The .htaccess file has many uses:
- For authorization & authentication purposes, such as requesting a password to access the website
- For rewriting URLs, including forcing websites to use HTTPS instead of HTTP
- For cache control
- For security purposes
- For setting custom error pages
When you shouldn't use .htaccess
What is .htaccess for? Should I use .htaccess? How to create .htaccess? Why can't I see the .htaccess file?