How to Edit Your .htaccess File

The .htaccess file contains directives (instructions) that tell the server how to behave in certain scenarios and directly affect how your website functions.

Redirects and rewriting URLs are two very common directives found in a .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

  • Edit the file on your computer and upload it to the server via FTP
  • Use an FTP program's Edit Mode
  • Use SSH and a text editor
  • Use the File Manager in cPanel

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 using this method and applies to Linux web hosting.

How to Edit .htaccess in cPanel's File Manager

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

To Open the File Manager

  1. Log into cPanel.
  2. In the Files section, click on the File Manager icon.
  3. Check the box for Document Root for and select the domain name you wish to access from the drop-down menu.
  4. Make sure Show Hidden Files (dotfiles)" is checked.
  5. Click Go. The File Manager will open in a new tab or window.
  6. Look for the .htaccess file in the list of files. You may need to scroll to find it.

To Edit the .htaccess File

  1. Right click on the .htaccess file and click Code Edit from 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.
  2. A dialogue box may appear asking you about encoding. Just click Edit to continue. The editor will open in a new window.
  3. Edit the file as needed.
  4. Click Save Changes in the upper right hand corner when done. The changes will be saved.
  5. Test your website to make sure your changes were successfully saved. If not, correct the error or revert back to the previous version until your site works again.
  6. Once complete, you can click Close to close the File Manager window.
Note: Instead of using the cPanel method, many people find changing the .htaccess file via FTP or SSH an easy alternative.

BACK

  • 5 Users Found This Useful
Was this answer helpful?

Related Articles

Server Management Panel - Using CPanel (Part I)

Server Management Panel Cpanel©(Part I) INDEX 1.- Preferences 1.1- Getting Started Wizard...

Server Management Panel -CPanel (General View)

We will access to the server management panel at the following address:...

How do I set up streaming video or music?

Many people have questions about media streaming support for their sites. Unless you have a...

What is CloudFlare? How do I enable it?

Shared plans may enable CloudFlare services via cPanel. The link is under the Advanced section....

How many servers does ICTEA have and where are they located?

ICTEA has over 7000 servers at SoftLayer (previously The Planet) in the following cities:...

Powered by WHMCompleteSolution