How to Locate and Create .htaccess File – A Step-by-Step Guide
access_time
hourglass_empty
person_outline

How to Locate and Create .htaccess File – A Step-by-Step Guide

.htaccess (hypertext access) is a hidden file used to configure additional features for websites hosted on Apache Web Server. With it, you can rewrite URL, password-protect directories, enable hotlink protection, disallow access to specific IP addresses, change your website’s time zone or alter default index page and much more. Here you’ll learn how to locate and create .htaccess file.

How to Locate an Open .htaccess File?

We will show how to locate and open .htaccess file in both Hostinger’s hPanel and cPanel.

hPanel

Finding and editing the file in Hostinger‘s hPanel takes only a few clicks. Here’s how to do it:

  1. Once you’re logged in to your WordPress Dashboard, use the search feature to find the File Manager located under the Files category.
  2. By default, .htaccess is not invisible in hPanel’s public_html directory, so you can immediately access the file and its content by right-clicking and either selecting Open or Edit.
    Locating the .htaccess file in hPanel

cPanel

If you are using cPanel, the process is more or less similar.

  1. Access File Manager -> public_html.
  2. If you can’t find the file, go to the  Settings on the upper right menu and tick the Show Hidden Files option to enable viewing.

IMPORTANT! This only applies to cPanel-based hosting platforms.

How to Create .htaccess File?

If .htaccess file is not present, here’s how you create one. This method is applicable to both hPanel and cPanel:

  1. Click the New File button in the upper menu.
  2. Enter .htaccess as the file name, insert the code below and press Create to save your changes.
    # BEGIN WordPress
    <IfModule mod_rewrite.c>
    RewriteEngine On
    RewriteBase /
    RewriteRule ^index.php$ - [L]
    RewriteCond %{REQUEST_FILENAME} !-f
    RewriteCond %{REQUEST_FILENAME} !-d
    RewriteRule . /index.php [L]
    </IfModule>
    # END WordPres

Conclusion

You’ve learned how to locate and create .htaccess file using the File Manager. .htaccess enables you to create website redirects, set default pages, password-protect directories and much more.

If you have any questions regarding this guide, let us know in the comments below!

The Author

Author

Tomas A. / @tomas

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.

Related tutorials

Author

marshadeans Reply

April 13, 2018

I'm 71and still have no idea how to get rid of 403 forbidden

Author

Avinash Reply

August 07, 2019

I can access my website using http:// but I can't access directly "tripticianandaman.in". How to solve this problem ????

    Author

    Domantas G.

    Replied on September 24, 2019

    Hey Avinash, Most likely you need to create a redirect from http to https. See instructions how to do this here.

Author

Muneeb Shahid Shahid Pervez Reply

September 25, 2019

Thank you for this post. this help me a lot. Good luck

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

Become a part of Hostinger now!

More in htaccess
How to Change the Default Index Page Using directoryindex and .htaccess

Close