How to Edit a File in cPanel File Manager

Instant Access Internet Services customers can edit a file in cPanel File Manager right in the browser - no FTP program or download needed. This is the quickest way to make a small change to .htaccess, wp-config.php, an HTML page or a PHP file. This guide walks you through opening the editor, saving your changes and backing up first so a mistake is easy to undo.

Before you start: make a backup copy

A typo in a configuration file can break your website. Take ten seconds to make a copy before you edit:

  1. In cPanel, go to Files > File Manager.
  2. Browse to the file, click it once to select it, then click Copy in the toolbar.
  3. In the path box, add a new name at the end, for example /public_html/wp-config-backup.php, and click Copy File(s).

If your edit goes wrong, you can delete the broken file and rename the copy back to the original name.

Looking for .htaccess and can't see it? It's a hidden file - see How to Show Hidden Files (.htaccess) in cPanel File Manager to turn on hidden files first.

How to edit a file in cPanel File Manager

  1. In cPanel, go to Files > File Manager.
  2. Open the folder that contains the file (your website's files are in public_html).
  3. Click the file once to select it, then click Edit in the toolbar. You can also right-click the file and choose Edit.
  4. A window may ask you to confirm the file's character encoding. Leave the detected encoding (normally utf-8) and click Edit.
  5. The file opens in the editor in a new browser tab. Make your changes.
  6. Click Save Changes in the top-right corner of the editor.
  7. Click Close to return to File Manager, then test your website in another tab.

The editor is a plain code editor with line numbers and colour highlighting. It saves exactly what you type, which is what you want for configuration and code files.

Edit vs. HTML Editor

When you right-click an .html file you may also see HTML Editor (Beta). This is an experimental visual editor. It can rewrite parts of your page's code when it saves, so for most changes we recommend the regular Edit option. If you do use the HTML editor, make a copy of the file first.

Tips for editing common files

  • .htaccess - rules are read from top to bottom. Add new rules on their own lines and don't remove the # BEGIN WordPress / # END WordPress block on a WordPress site.
  • wp-config.php - add custom lines above the line that says /* That's all, stop editing! */. Don't leave stray spaces or blank lines before the opening <?php.
  • PHP files - one missing semicolon or bracket can cause a blank page or "500" error. Undo your last change if the page stops loading.
  • Theme and plugin files - changes you make are overwritten the next time that theme or plugin updates. Use a child theme or a code-snippets plugin for lasting changes.

Troubleshooting

The Edit button is greyed out

Some actions only work on one file at a time. Make sure exactly one file is selected (not a folder, and not several files).

The file is too large to edit

File Manager can only edit files up to 1 MB. For larger files, click Download, edit the file on your computer with a text editor (such as Notepad++ or VS Code), then upload it back with Upload. Or use FileZilla - see How to Connect to Your Website with FileZilla (FTPS).

The file shows strange symbols

The wrong character encoding was selected. Click Close without saving, then open the file again and choose the correct encoding (almost always utf-8). Saving with the wrong encoding can corrupt the file.

My site shows a 500 error after I saved

Open the file again and undo your last change, or restore the backup copy you made. If you didn't make one, you can restore the file from an automatic backup with How to Restore a File or Folder with JetBackup 5. Your error log can also point to the exact line - see How to Check Your Website Error Log and Recent Visitors.

I saved but the website still looks the same

You may be seeing a cached copy. Clear your browser cache, and if you use WordPress, purge the LiteSpeed Cache (see How to Speed Up WordPress with LiteSpeed Cache). Also double-check you edited the file in the right folder.

Related guides

Still stuck? Open a support ticket and the Instant Access Internet Services team will help.

Ultrafast LiteSpeed hosting from InstantAccess.net: free SSL, free backups, cPanel included, no contracts. Check out our $10/month hosting.
  • edit file cpanel, cpanel file manager edit, edit htaccess cpanel, edit wp-config.php cpanel, cpanel code editor, cpanel file manager save changes
  • 0 Users Found This Useful
Was this answer helpful?

Related Articles

How to Show Hidden Files (.htaccess) in cPanel File Manager

If you are looking for your .htaccess file and it isn't there, it's almost certainly just hidden....

How to Use cPanel File Manager to Manage Your Website Files

cPanel File Manager lets you work with your website files right in your web browser -- no FTP...

How to Upload and Extract a ZIP File in cPanel

The fastest way to put a whole website or a folder full of files on yInstant Access Internet...

How to Compress and Download a Folder in cPanel

cPanel File Manager can download single files, but not whole folders. The trick is to compress...

File and Folder Permissions Explained (644 and 755)

File and folder permissions control who can read, change and run the files on your website. Most...