.htaccess files are text files that tell your server how to handle different aspects of your webpage’s display. These include redirects, protecting directories, enabling compression, rewriting URLs, and more.

To break down the file name, ‘htaccess’ stands for ‘hypertext access’, and the full-stop at the front indicates that it’s a hidden file. This means ‘.htaccess’ is the full file name, not an extension, so as Htaccess Guide notes, you wouldn’t have a file called ‘file.htaccess’; it would simply be called ‘.htaccess’.

.htaccess files can be used to do things to webservers such as Apache and Litespeed that would otherwise need to be done within the configuration files of the webservers themselves. This means you can use .htaccess files to alter the functionality of these webserver’s different features, such as redirects as mentioned above.

How to use .htaccess files:

In order to edit .htaccess files that already exist, you first need to locate them with a file manager or FTP program (File Transfer Protocol) – OSTraining gives a good step by step guide on how to do this.

Once you have found the file you want to edit, make sure to save a copy of it. With .htaccess files, it is easy to inadvertently make a mistake in the code that mucks up your web page display quite significantly, so it’s always important to save an original copy before you start tinkering!

When this is all done, you can start editing (or writing from scratch) your .htaccess files. As it’s a text file, you can do this with almost any text editor, such as TextPad or WordPad (though it should be noted that you can’t use Microsoft NotePad). Htaccess Guide gives a good example of a typical .htaccess file layout here, and also has additional resources on how to create .htaccess files for specific purposes like password protection, setting server timezone, and many others.

Once you’re done editing or writing your file, it’s time to upload it. This is done by placing it in a directory, which is then loaded via your webserver software (such as Apache). To place it in a directory, you would need to use a FTP program such as download.com which is free, or WSFTP which is paid. When you are doing this, it’s important to make sure your .htaccess file is in ‘ASCII’ mode, and not the typical FTP default ‘Binary’.

The .htaccess file should then take control over whichever directory it has been placed in, including all of that directory’s subdirectories and files. You can check if the .htaccess file is working as intended by visiting the directory it has been placed in with your web browser.

It’s worth noting that although your .htaccess files may not appear in the directory listings on your website, this is likely because either your server or FTP software is hiding them, so this is completely normal.

Take our SEO Audit Challenge! We'll find at least one issue causing your website to lose traffic (and our time won't cost you a penny).

Your website

Your Email