What is the .htaccess file: Complete Guide

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

How to locate and open the .htaccess file?

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

hPanel

Finding and editing the file in hPanel requires only a few clicks. This is how you do it:

  1. Once you are logged into your WordPress dashboard, use the search function to find the file manager located in the category Records.
  2. By default, the file .htaccess is not invisible in the directory public_html of hPanel, so you can immediately access the file and its contents by right-clicking and selecting Open either Edit.

cPanel

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

  1. Access the File Manager -> public_html.
  2. If you can’t find the file, go to the setting in the upper right menu and select the option show hidden files to enable display.

IMPORTANT! This only applies to cPanel based hosting platforms.

How to create a .htaccess file?

If the file .htaccess is not present, this is how to create one. This method applies to both hPanel and cPanel:

  1. Click on the button new file in the top menu.
  2. enter .htaccess as the file name, insert the code below and press Create to save the changes.
See also  How to migrate your website from Joomla to WordPress (in 5 steps)

# BEGIN WordPress RewriteEngine On RewriteBase / RewriteRule ^index.php$ – RewriteCond %{REQUEST_FILENAME} !-f RewriteCond %{REQUEST_FILENAME} !-d RewriteRule . /index.php # END WordPress

conclusion

You have learned how to locate and create the file .htaccess using the File Manager. .htaccess It allows you to create website redirects, set default pages, password protect directories and much more.

If you have any questions about this guide, let us know in the comments below.

Gustavo is passionate about creating websites. He focuses on the application of SEO strategies at for Spain and Latin America, as well as the creation of high-level content. When he is not applying new WordPress tricks you can find him playing the guitar, traveling or taking an online course.

Loading Facebook Comments ...
Loading Disqus Comments ...