The .htaccess file is a configuration file.

For the server to use the file it must be named .htaccess, not htaccess.txt. Joomla comes with a file in the root with the name htaccess.txt and you must rename this file to .htaccess for it to be enabled.

It has code that controls the directory where it resides and any sub-directories below it. If an .htaccess file is placed in a sub-directory, it can overwrite settings in the higher .htaccess.

You will only see .htaccess files on Apache based web servers, not on .NET servers.

.htaccess files can have a few lines or many lines.

Some hosting companies will not allow the use of .htaccess files. Before installing an .htaccess file in the files for your site, be sure it is allowed and will not cause conflicts.

Be very careful editing the .htaccess file as it can cause errors on your site.

Things the the .htaccess configures

  • custom error pages
  • setting up your site to use a file other than index.php for the landing page if someone types in the URL of your domain name
  • setting up Redirects for old URLs to be sent to the proper new URL
  • adding password protection to files and directories
  • blocking specific users by IP address
  • blocking other sites from your site to stop things like hotlinking your images
  • blocking bad "bots" and "spiders" that cause bad things to happen to your site and or email
  • adding particular MIME types to allow specific file types to be used
  • preventing directory listing - such as images or directories that you wouldn't want people to see all the contents

Here is a good resource for the things that a .htaccess can do:


If you are editing your .htaccess file, always make a backup of the current file before editing - so you can revert back to that if your site is broken after saving the edited file.

Joomla's htaccess.txt contains the 404 redirect to the error.php file in your default directory. If you do not rename the htaccess.txt file, you may find that the error.php page that comes with your template does not appear.