.htaccess files are Apache configuration files which provide a way of making very specific rules in a directory. This type of file can be used to make redirections or to protect a directory with a password.

Before you get started we should make a few things clear about .htaccess files. Firstly, these files are specific to the web server and they are not visible in the directory when someone types the directory name into their browser. You should also be aware that the settings applied by an .htaccess file apply not only to the directory which contains the file, but also to its subdirectories.

Use cases

.

How to password protect a directory on your website

.

How to block certain IPs from your website

.

URL rewriting using mod_rewrite

.

Other things you can do with .htaccess