How to Edit a Website File on Your Server

Learn How to Edit a Website File on Your Server

In this guide, we will show you how to edit a website file on your server. Many times when you are configuring your website you will need to modify a file, such as when you are updating a code or a file path. There are several ways you can do this. For example, you can use the cPanel File Manager editor, an FTP program, or a program like Notepad++ to edit files.

NOTE: When updating files on your server, you may need to clear your browser cache to see the changes. For more information on clearing your browser cache, please see the article on How to Clear Your Browser’s Cache.

Edit a Website With File Manager in cPanel

You can edit files directly on your server using the File Manager editor. File Manager is a browser-based editor you can find in your cPanel.

This is sometimes called “Editing on the fly“. Editing on the fly is usually reserved for minor changes. When editing files directly on the server, the change takes effect immediately. The problem with editing files directly on the server is that you are editing the live copy. When editing the live copy, your site can break if a mistake happens and you cannot undo the change after it is saved.

In order to edit a backup copy of your files, you may want to use FTP instead. This is because, with FTP you typically download a copy of the file you want to edit, then upload and replace the old file. We will cover FTP more in-depth in the sections below. But, first here is a general step-by-step on how to edit files through the File Manager.

NOTE: If you do not know where your files are located on the server, please see our article on What directory should I put my files in?.

  1. Log into your cPanel.
  2. Go to the File Manager in cPanel.
    Edit Website Files with cPanel File Manager
  3. Select your directory.
  4. Right-click and Edit the file with the File Manager editor.
    Edit .htaccess File and Setup 301 Redirect
  5. You can then edit the file as needed.
    Editing a File Using cPanel File Manager
  6. Save the changes. You can then view your live site and see the changes.

Using FTP to Edit Website

Files can be downloaded and uploaded using an FTP client installed on your computer. For example, you can edit a PHP file, or edit an HTML file by downloading it and making changes then uploading it when you are finished.

Since FTP programs run directly on your computer, there is no need to access cPanel or an internet browser before accessing your files.

Below are the basic steps to edit a file using FTP. For more information please see our Getting Started Guide: FTP article.

  1. Connect with FTP. Below is a screenshot of FileZilla connected to my server’s public_html folder.
    Connected to FTP Using FileZilla
  2. Download the file.
  3. Edit the file on your computer with notepad or another code editor such as Sublime Text.
  4. Re-upload the file to the server and overwrite the existing file. The changes should reflect now on your live site.

Edit a Website With an Editor Like Notepad++

You can edit files directly on your server using Notepad++. NotePad++ is a Windows-based editing program that also has FTP capabilities. This means you can use this single program to connect with FTP and edit the file as well.

For information on editing your files with Notepad++, please see the following article:

To see other articles available on how to manage your files, please visit How to manage your files on your server?.

Make sure your business, agency, or reseller clients are always connected and powered on with our optimized Managed VPS Hosting.
Share this Article
IC
InMotion Hosting Contributor Content Writer

InMotion Hosting contributors are highly knowledgeable individuals who create relevant content on new trends and troubleshooting techniques to help you achieve your online goals!

More Articles by InMotion Hosting