How to Edit a .htaccess File in cPanel Using The File Manager

If you are familiar with what a .htaccess file is and why you should use a .htaccess file, let’s get on to how you can go about editing it. While there are many customizations that you can effect to the Apache setup with the use of a .htaccess file, the most common ones include Rewriting URLs and redirecting URLs. There are many CMSes like Joomla, Magento, Drupal and WordPress. All use their own auto-written .htaccess files in order for them to function properly.

At some point in time, you may be required to edit your website’s .htaccess file for varied reasons. This article covers how to locate, open and edit your file. what changes you need to make in your .htaccess file is not covered within this article. If you would like to learn how to make different changes to your Apache setup using the .htaccess file, kindly refer to a different article.

There are various ways in which you can locate and edit your .htaccess file. Below is a list of methods or ways you can follow to open and edit your .htaccess file:

  1. Using the “File Manager” from cPanel to edit the .htaccess.
  2. Use PuTTY, SSH and a text editor to edit the .htaccess.
  3. Using your FTP program and it’s Edit mode to remotely edit a file.
  4. Download the file edit it and upload it again

In this article, we are covering the first method i.e., how to use the ‘file manager’ to open and edit the .htaccess file in cPanel.

Using the “File Manager” to open & edit the .htaccess file in cPanel:

In order to open and edit a .htaccess file using the cPanel, you can first login into the cPanel account. Once you are logged in, follow the following steps provided below:

a. Search and locate the File Manager icon as shown in the image below:

Search and click on the file manager icon

b. Clicking on the ‘File Manager open the file manager in a new tab.
c. Check the below image to see the link to ‘public_html‘ which is the root folder of your web hosting account, click on it:

d. Clicking on the public_html link will open the file system of the website. Try and locate the .htaccess file here. If you are unable to locate it, its mainly due to the fact that dotfiles may be hidden. In this case, we will need to click on the ‘settings’ button located on the top right section of your browser window.

where is the settings button on cPanel

e. look at the settings section below and click on the ‘Show Hidden Files (dotfiles)’ check box and click on ‘Save‘ as shown in the image below:

click on the show hidden files dotfiles checkbox

f. Now, locate and click on the ‘.htaccess‘ file to select it and then click on the ‘Edit‘ button as shown in the image below:

select the .htaccess file and click on the edit button

g. This will open the file in the editor (in a new tab) and, it will allow you to make and save changes on it. That’s it! This is how you open and edit a .htaccess file in cPanel using the file manager.


Please enter your comment!
Please enter your name here