How to Locate (or create) .htaccess File

.htaccess is a hidden file that is used for your website’s configuration. Using it, you can do URL rewriting, password protect directories, enable hotlink protection, disallow access to specific IP addresses, change your website’s time zone or default index page and much more. This tutorial shows how to locate (or create) .htaccess file by using File Manager in your hosting control panel.

What you’ll need

Before you begin this guide you’ll need the following:

  • Access to hosting account’s control panel

Step 1 — Locating and Opening File Manager

Navigate to your hosting account’s control panel and open up the File Manager tool located in the Files category:

File Manager location on Hostinger panel

If you are using cPanel, the section can also be found under the Files category.

Opening File Manager

Step 2 — Locating .htaccess file in File Manager

.htaccess file is located in your public_html directory. You can quickly access the file and it’s content by right-cliking and selecting Edit:

Editing htaccess on Hostinger

If your hosting platform uses cPanel, the process is more or less the same.

Opening .htaccess file

In case there is no .htaccess file, check if Show Hidden Files is enabled in your File Manager settings:

IMPORTANT! This only applies to cPanel based hosting platforms.

Enable hidden files

Step 3 — Creating .htaccess file if it is not present

If the .htaccess file still has not appeared, simply create it by right-clicking on a blank area in your File Manager and select New File option.

Creating a new htaccess file part 1

After that, enter the name .htaccess and press Create to save it. You will then be able to access your newly created file and manage the code.

Creating a new htaccess file part 2

The process creation process is almost the same for cPanel based webhosting platforms. To generate the new file, you will need to press File section inside your File Manager:

Create htaccess file


You have learned how to locate the .htaccess file using File Manager located in the hosting control panel. Knowing how to locate or create and edit .htaccess file will empower you to create website redirects, set default pages, password protect directories and much more.

About the author

Tomas A.

Tomas is a senior customer support agent at Hostinger. Besides providing top-notch technical advice on a daily basis, he likes to create websites and do various coding side projects.


Click here to post a comment

This site uses Akismet to reduce spam. Learn how your comment data is processed.

Get Exclusive Content

Join thousands of webmasters who get our free newsletter with tips on how to drive more traffic and revenue to their websites!

Please wait...

Thank you for sign up!

More in htaccess
How to Allow or Block Visitors From Specific Countries Using .htaccess