New Customers: 50% OFF Your First Month on All VPS Servers & Web Hosting Plans!

How to Edit .htaccess File via the cPanel Filemanager?

This guide walks through editing .htaccess in cPanel's File Manager, including how to show hidden files, locate the correct document root, back up before editing, and troubleshoot common errors like 500 Internal Server Error.

HostworldWeb hosting & cPanel 3 min read Updated 23 Sep 2026

You edit .htaccess in cPanel by using File Manager: enable Show Hidden Files, go to the correct domain’s document root, back up the file, then click Edit to change it. If anything breaks, restore your .htaccess.bak copy or recover the file from Trash.

Before you start

  • Your cPanel login for the hosting account.
  • The exact domain or subdomain you are changing. The rules must go in that domain’s document root.
  • A rollback plan. You will make a quick backup before you edit.

Step 1: Open File Manager and show hidden files

  1. Log in to cPanel.
  2. Open File Manager.
  3. Click Settings at the top right. Tick Show Hidden Files (dotfiles). Optional: set the start directory to Document Root for: and pick your domain, then click Save.

Step 2: Go to the correct document root and locate .htaccess

  1. Open the domain’s document root. The primary domain is typically public_html. Addon domains and subdomains have their own document roots.
  2. If you do not see .htaccess, use the Search box at the top right and limit the search to the current directory or to public_html if needed.
  3. If the file does not exist, click + File, name it .htaccess, confirm the path is the domain’s document root, then create it.

Step 3: Back up .htaccess so you can undo

  1. Select .htaccess and click Download to keep a local copy.
  2. Also click Copy and create .htaccess.bak in the same folder. To undo later, rename .htaccess.bak back to .htaccess.

Step 4: Edit the file and save

  1. Select .htaccess and click Edit. You will see a character encoding check. Confirm the correct encoding, usually UTF‑8.
  2. If the contents display as gibberish, click Cancel and reopen with the correct encoding to avoid corrupting the file.
  3. Make your changes and click Save.
  4. If File Manager refuses to edit because the file is larger than 1 MB, use Download, edit locally, then Upload it back to the same path.

Step 5: Test and roll back if needed

  1. Reload a few pages that the change should affect. Remember: .htaccess applies to its directory and all subdirectories.
  2. If you get a 500 error, restore your backup: rename .htaccess.bak to .htaccess. If you deleted the file by mistake, open Trash in File Manager and Restore it.

If it does not work

  • 500 Internal Server Error after saving: restore your backup first. Then check for syntax mistakes and use Apache 2.4 syntax. Replace legacy lines like Order allow,deny and Allow from all with Require all granted or similar as appropriate.
  • Changes have no effect: you likely edited the wrong place. Confirm you are in the correct domain’s document root. If you used cPanel’s Redirects, the rules are appended at the bottom of the domain’s .htaccess. Some applications only act on rules inside their own section, so move or merge your rules into the correct section or above the app’s block. Also check permissions: .htaccess 0644 and the document root directory 0755.
  • Cannot see .htaccess: open File Manager settings and tick Show Hidden Files (dotfiles). Use the Search box. If you deleted it, restore it from Trash. If you are still stuck, open a support ticket.

What next

If you need server-level control beyond .htaccess, see our VPS guides. If you want an isolated environment to test configuration changes, look at our Linux VPS. If anything here is unclear or you hit an error you cannot trace, please open a support ticket so we can help.

Common questions

How do I show hidden files in cPanel File Manager?

Log into cPanel, open File Manager, click Settings at the top right, tick Show Hidden Files (dotfiles), then click Save.

Where should I place my .htaccess file?

Place it in your domain's document root. The primary domain's document root is usually public_html; addon domains and subdomains have their own document roots.

How do I undo changes to .htaccess if something breaks?

Before editing, create a backup copy named .htaccess.bak in the same folder. If something goes wrong, rename .htaccess.bak back to .htaccess to restore it.

What does a 500 Internal Server Error mean after editing .htaccess?

It usually means there is a syntax error in the file. Restore your .htaccess.bak backup first, then check for syntax mistakes and use Apache 2.4 syntax.

Why are my .htaccess changes not taking effect?

You may have edited the wrong document root. Confirm you are in the correct domain's folder, check file permissions (.htaccess should be 0644), and verify your rules are not inside an application-specific block that overrides them.

Was this article helpful?