How to locate or create .htaccess file?

.htaccess is a hidden file used to configure a website. Using it, you can rewrite URLs, set directory protection, enable hotlink protection, disallow access to specific IP addresses, change your site’s time zone and default index page, and more. This tutorial shows you how to locate (and create) this file using the File Manager of the hosting control panel.

What do you need to prepare?

Before starting you need to prepare:

  • Login your hosting’s control panel

Step 1 – Locate and open File Manager

Navigate to the hosting control panel of the hosting account and open the File Manager tool located in the Files category:

If you are using cPanel, this item can also be found in the Files category.

Step 2 – Locate .htaccess file in File Manager

The .htaccess file is located in the public_html directory. You can access this file and edit its content by right-clicking and selecting Edit:

If your hosting platform uses cPanel, this is the same.

In case there is no .htaccess file, check whether Show Hidden Files is enabled or not:

Step 3 – Create a .htaccess file if it does not exist

If the .htaccess file does not exist, just create the new file by right-clicking on the space in the File Manager and selecting New File.

Then, enter the name .htaccess and click Create to save. You will be able to edit the code in that file later.

Installation is similar to cPanel. To create a new file, you will need to click the File button in the File Manager:

Conclusion

You already know how to locate the .htaccess file through File Manager in the hosting control panel. Know where this file is located, and know how to create and edit files that will give you better control over your website, so you can create redirections, set default pages, create passwords for folders and more.

Leave a Reply

Your email address will not be published. Required fields are marked *