.htaccess (come from hypertext and access) is a configuration file, used by the web server Apache. This is a text file that could be created with a text editor. .htaccess file has a recursive action, i.e. it applies to the directory, where it is located and for all its sub-directories. .htaccess file must begin with the sign “point”.

The main functions of .htaccess file are:

• Allow/Forbid opening of a page for specific IP addresses;
•  Allow/Forbid displaying of a list of files in a directory and allow changing of the appearance;
• Allow access to a directory, only after entering a valid username and password (use additional file storage of passwords);
• Can set redirection to another URL address;
• Can set rules for rewriting the URL addresses (mod_rewrite);
• Can allow/forbid access to certain files;
• Can change the index file of the directory;
•  Can change the error messages of Apache (404, 500, 401, 403) and others.

How can I secure my .htaccess file?

The file is already protected; it will be forbidden to browsers. To be very sure, double check that the file is named ".htaccess" and not "htaccess" nor "htaccess.txt". (It must start with a dot.)

Can I delete my .htaccess file permanently?

You can delete the .htaccess file, but it will reappear immediately as a blank file. Websouls has default directives which will always be in place unless you create your own directives to overrule ours.
How to Edit Your .htaccess File

The .htaccess file contains directives (instructions) that tell the server how to behave in certain scenarios and directly affects how your website functions. Redirects and rewriting URLs are two very common directives found in an .htaccess file, and many scripts such as WordPress, Drupal, Joomla, and Magento add directives to the .htaccess so those scripts can function.

It is possible that you may need to edit the .htaccess file at some point, for various reasons.  This article covers how to edit the file, but not what to change.  (You may need to consult other articles and resources for that information.)

There are many ways to edit a .htaccess file.

  1. Edit the file on your computer and upload it to the server via FTP.
  2. Use an FTP program's "Edit" mode that allows you to edit a file remotely.
  3. Use the File Manager in cPanel to edit the file.

The fastest and easiest way to edit a .htaccess file for most people is to use the File Manager in cPanel.  This article covers how to edit it using this method.
How to Edit .htaccess in cPanel's File Manager

Before we do anything, it is suggested that you back up your website so that you can revert back to a previous version if something goes wrong.

To edit the .htaccess file, first we will open the File Manager:

  1. Login to cPanel.
  2. Click on "File Manager" in the "Files" section.
  3. Select "Document Root for:" and select the domain name you wish to access.
  4. Make sure "Show Hidden Files (dotfiles)" is checked.
  5. Click the "Go" button.

The File Manager will open in a new tab or window.

  1. Look for the .htaccess file in the list of files.  You may need to scroll to find this file.
  2. Right-click on the file and click on "Code Edit" on the menu.  (Alternatively, you can click on the icon for the .htaccess file and then click on the "Code Editor" icon at the top of the page.)
  3. A dialogue box may appear asking you about encoding.  Just click on the "Edit" button to continue.

The editor will open in a new window.

  1. Edit the file as needed.
  2. Click on the "Save Changes" button in the upper right-hand corner when done.

The changes have been saved.  Test your website to make sure it has the desired effect.  If not, correct the error or revert back to the previous version until your site works again.

Was this answer helpful? 0 Users Found This Useful (0 Votes)