Editing Files Using the cPanel File Manager
cPanel's File Manager includes a built-in text editor that allows you to make changes to your website files directly in your browser. This guide will show you how to use the text editor to view and modify files on your dotCanada.com hosting account.
Accessing File Manager
- Log in to your cPanel account at https://{hostname}.mysecureservers.com:2087
- In the search box at the top, type "File Manager" or navigate to the FILES section
- Click on File Manager
- A dialog box may appear asking which directory you want to open. For website files, select:
- Web Root (public_html/www) - This is where your website files are located
- Alternatively, you can choose "Home Directory" to see all folders
- Click Go to open File Manager
Opening Files for Editing
Method 1: Using the Edit Option
- Navigate to the directory containing the file you want to edit
- Click on the file to select it
- Click Edit in the top toolbar
- If it's your first time opening a file, you may see a character encoding dialog box
- The default option (UTF-8) is suitable for most files, so click Edit to proceed
- The file will open in the text editor
Method 2: Right-Click Method
- Navigate to the directory containing the file you want to edit
- Right-click on the file
- Select Edit from the context menu
- Confirm the character encoding if prompted
- The file will open in the text editor
Understanding the Text Editor Interface
The cPanel text editor includes several features:
- Menu Bar: Contains options like Save, Find, Replace, etc.
- Editing Area: The main space where you edit the file contents
- Line Numbers: Displayed on the left side for easy reference
- Syntax Highlighting: Colors code elements differently for readability (for HTML, CSS, JavaScript, PHP, etc.)
Editing and Saving Files
- Make your desired changes to the file content in the editing area
- When finished, click Save Changes in the top-right corner (or use the keyboard shortcut Ctrl+S / Command+S)
- The changes will be saved, and you'll return to File Manager
- To keep editing, you can click Save and Keep Editing to save without closing the editor
Using Advanced Editor Features
To find text in your file:
- Click Find in the editor toolbar (or use Ctrl+F / Command+F)
- Enter the text you want to find
- Use the search navigation buttons to move between occurrences
To replace text:
- Click Replace in the editor toolbar (or use Ctrl+R / Command+R)
- Enter the text to find in the first field
- Enter the replacement text in the second field
- Click Replace to replace one instance or Replace All to replace all occurrences
To jump to a specific line number:
- Click Go to Line in the editor toolbar (or use Ctrl+G / Command+G)
- Enter the line number
- Press Enter or click Go
This is particularly useful when debugging errors that reference specific line numbers.
The editor includes several formatting aids:
- Syntax Highlighting: Automatically colors code based on the file type (HTML, CSS, PHP, etc.)
- Line Indentation: Use Tab key to indent or Shift+Tab to outdent selected lines
- Auto-indent: The editor maintains proper indentation when you create new lines
- Line Wrapping: You can toggle line wrapping for long lines
Made a mistake? You can undo and redo changes:
- Undo: Click the Undo button in the toolbar or use Ctrl+Z / Command+Z
- Redo: Click the Redo button in the toolbar or use Ctrl+Y / Command+Y
The editor maintains your undo history throughout your editing session.
Creating New Files
- Navigate to the directory where you want to create the new file
- Click New File in the top toolbar
- Enter the file name with the appropriate extension (e.g., index.html, style.css, config.php)
- Click Create New File
- The file will be created and then open in the text editor
- Add your content and click Save Changes when done
File Types That Can Be Edited
The cPanel File Manager text editor works best with these file types:
- HTML Files: .html, .htm
- CSS Files: .css
- JavaScript Files: .js
- PHP Files: .php, .php5, .phtml
- Text Files: .txt, .log
- Configuration Files: .htaccess, .ini, .conf
- XML Files: .xml
- JSON Files: .json
Best Practices for File Editing
- Create backups before editing:
- Select the file
- Click Copy
- Rename the copy with a .bak extension or similar
- Test changes: After saving, check your website to ensure the changes have the intended effect
- Keep track of changes: Add comments to your code explaining what you changed and why
- Use proper file permissions: Most web files should have 644 permissions after editing
- Be careful with critical files: Take extra care when editing files like .htaccess, wp-config.php, or configuration files
Troubleshooting Common Editing Issues
File Is Not Writable
If you get a "File is not writable" error:
- Select the file in File Manager
- Click Permissions in the top toolbar
- Set the permissions to 644 (or 666 temporarily if needed)
- Click Change Permissions
- Try editing the file again
Character Encoding Issues
If you see strange characters or encoding problems:
- Make sure you're using the correct character encoding (UTF-8 is recommended)
- When opening the file, select the appropriate encoding in the dialog box
- For severe encoding issues, you may need to download the file, fix it locally, and upload it again
Editor Not Loading
If the editor doesn't open or load correctly:
- Try refreshing your browser
- Clear your browser cache
- Try a different web browser
- Check if the file is too large (very large files may cause the editor to fail)
If you need assistance with editing files or have questions about specific file types, please contact our support team.