HostMonster Web Hosting Help

How to edit your .htaccess


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 an .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 SSH and a text editor to edit the file.
  4. Use the File Manager in cPanel to edit the file.

The fastest and easiest way to edit an .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 backup 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.
  6. Look for the .htaccess file in the list of files. You may need to scroll to find this file.
  7. 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.)
  8. 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.
  9. Edit the file as needed.
  10. 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.
  11. Once complete, you can click "Close" to close the window.

Once complete, you can click "Close" to close the window.

Knowledgebase Article 28,206 views bookmark tags: (updated 992 days ago)

Was this resource helpful?

Did this resolve your issue?

Please add any other comments or suggestions about this content:

Recommended Help Content

What is the .htaccess file and where can I find more information? (updated 905 days ago)
Knowledgebase Article 1,491,897 views tags: htaccess tips tricks

I am trying to edit my web page and I have no idea how to? I need to know how to go into the site and fix it. My webpage has a error in the first paragraph. I don't know how to fix it? Can you help? (updated 1134 days ago)
Knowledgebase Article 169,803 views tags: edit html upload webpage

How to run CGI scripts for Addon domains. (updated 1174 days ago)
Knowledgebase Article 88,399 views tags: cgi htaccess

Related Help Content

How do I perform a URL redirect/rewrite using the .htaccess file? (updated 219 days ago)
Knowledgebase Article 735,740 views tags: htaccess redirect rewrite url

Preventing bandwidth theft using the mod rewrite engine and .htaccess (updated 1175 days ago)
Knowledgebase Article 104,045 views tags: htaccess rewrite

This article will explain how to add a PHP handler to your .htaccess files. This is useful if you want to customize the version of PHP that runs your PHP files. (updated 34 days ago)
Knowledgebase Article 1,615 views tags: htaccess php

How do I make a sub directory (or sub folder) act as the public_html for your main domain? (updated 15 days ago)
Knowledgebase Article 590,367 views tags: Drupal domain htaccess joomla wordpress

Explains the use of DirectoryIndex and how to use it. (updated 982 days ago)
Knowledgebase Article 22,132 views tags: cpanel htaccess

This article will show a way to protect specific pages of your website with SSL. This may have benefits for SEO and can be used on pages that contain forms, shopping carts or any other page where users might enter sensitive information. (updated 165 days ago)
Knowledgebase Article 3,023 views tags: htaccess pages specific ssl

Hard refresh after changing the .htaccess (updated 968 days ago)
Knowledgebase Article 53,521 views tags: apache

When performing an upgrade (in this case, Joomla) in Simple Scripts, it can throw the following error: "Host Server Unresponsive Unfortunately, the server you are attempting to install on appears to b (updated 2157 days ago)
Knowledgebase Article 69,020 views tags: htaccess scripts simple