HostArmada Web Hosting Knowledge Base

Knowledge is power! Use that power and achieve total and unconditional control over the Web Hosting Services!

What is a .htaccess file and where can I find it?

In your experience with Web Hosting, you may have heard the term ".htaccess", however, it has always scratched your mind as to what exactly is it and why it is used?

Hypertext Access or, in short, ".htaccess" is a configuration file used by the Apache Web Server. This file allows you to control different aspects of the web behavior for physical folders hosted on your Web Hosting account. In other words - you will be able to specify what web properties the Web Server should enable for a folder when the same is being accessed over the web.

Typically the Web Server has a global configuration file in which the default behavior of folders is already configured. However, such a global configuration is valid for any folder hosted on the Web Hosting server. Sometimes you might want to have an additional configuration enabled on a per-folder basis and not on a global scale. In this particular case, the only way to achieve a custom behavior for a specific folder is to use the ".htaccess" file.

Once placed within a folder, the ".htaccess" file and all the configuration directives it contains will be valid for the folder itself along with all other folders contained within the current one.

  • Here are some examples of the goals you can achieve using the ".htaccess" file:
  • Enable hotlink protection for your site.
  • Add redirecting rules for URLs
  • Force HTTPS redirection.
  • Password-protect the directory containing the .htaccess.
  • Show custom error pages, such as 403 and 404 pages.

All of these along with many more are represented with specific rules often called .htaccess directives which you need to understand very well and be familiar with their syntax. Otherwise, you might cause the complete unavailability of your website due to syntax errors in the “.htaccess” file. Typically the error code you should expect in case of an error with the syntax is 500.


You will typically find the .htaccess file located within the root directory of your website. If you are not sure what a root directory is, then please refer to our article about finding the root directory of your domain. Usually, this file will be hidden as it may be used to compromise your account. Luckily, all the means to access the ".htaccess" file have an option to show hidden files. You may access it in three different ways:

  • Through FTP - The way to show hidden files will vary based on your FTP client. To show them in FileZilla, please press the "Server" menu on the top and enable the "Force showing hidden files" from the dropdown.
  • Through the cPanel's File Manager - Once you are inside the file manager, please press on the "Settings" button located on the top right corner of the page. This button will show a popup window, and inside, you will see a checkbox called "Show Hidden Files (dotfiles)". Please put a tick inside to reveal the hidden files and click the "Save" button.
  • Through SSH - When you connect through SSH, please navigate to the website's directory using the commands provided in our Linux Commands Basics. When you are within the correct folder, please type in the command:
 ls -la 

This will display all the hidden files.

To edit the “.htaccess” file, please use the vim editor. If such a file does not exist for the specific site, please do not worry, as you can create it using all of the above methods and still take advantage of its features.

Was this article useful and on point?

Find out more about HostArmada entire range of optimized Web Hosting Services and take action today on improving your website Loading Speed, Security, and overall Stability!