.htaccess basic configuration

less than 1 minute read

Apache logo

Here I will explain a basic configuration of a ‘.htaccess‘. This file is a directory-level configuration file supported by several web servers, that allows for decentralized management of web server configuration. It’s more secure to edit the ‘.htaccess‘ than que ‘http.conf‘.

With this file you can configure a lot of things in Apache, but the most interesting (for me) are:

404 Custom Error Page

ErrorDocument 404 code/404.php

301 Redirect

Redirect 301 /path/old.php /path/new.php

Prevent Directoy Listing

IndexIgnore *

Custom Index Files

DirectoryIndex index.html index.php helloo.html