You can edit the htaccess file by FTP or shell

Yes, you can edit the htaccess file by FTP or shell very easily. Here are the complete process involved to edit the .htaccess file by FTP as well as Cpanel.

In simple words, the .htaccess file contains instructions (directives) that tell the server how to behave in certain conditions and also contols the functioning of your website.

The two very common and important directives of a .htaccess file ate redirects and rewriting URLs. Many Content Management System (CMS) such as WordPress, Drupal, Joomla, and Magento add directives to the .htaccess file so that those CMS can run properly.

You may need to edit the .htaccess file for various other reasons. I had shared both ways in this article, you can follow the detailed steps and make the changes to your htaccess file easily.

There are many ways to edit a .htaccess file.

  1. Edit the file on your computer and upload it to the server via FTP i.e, File Transfer Protocol.
  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.

I must add that 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 as well via FTP or Filezilla.

How to edit .htaccess file by FTP (Filezilla)

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.

  • Open FileZilla and log in to your web space using FTP.
  • Double-click public_html to list your website files.
  • Select .htaccess, right-click and select View/Edit.
  • Enter your new code. Save the file once you have finished editing.
  • Click Yes in FileZilla to upload your new .htaccess file.

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:

  • Login to cPanel.
  • Click on “File Manager” in the “Files” section.
  • Select “Document Root for:” and select the domain name you wish to access.
  • Make sure “Show Hidden Files (dotfiles)” is checked.
  • Click the “Go” button.
    The File Manager will open in a new tab or window.
  • Look for the .htaccess file in the list of files. You may need to scroll to find this file.
  • 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.)
  • 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.
  • Edit the file as needed.
  • 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.
  • Once complete, you can click “Close” to close the window.

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

Leave a Comment

Your email address will not be published. Required fields are marked *

Scroll to Top