Losing website files in How to Restore a Website After Accidentally Deleting Files in cPanel situations can feel like the end of the world, especially when the homepage suddenly returns a 404 or a blank screen. I managed to do this to one of my own test sites years ago by deleting what I thought was an old backup folder. It wasn’t the backup folder.
Quick Answer
If you’ve accidentally deleted website files in cPanel:
- Check the Trash folder inside File Manager first.
- Restore from your hosting provider’s backup if one exists.
- Restore your own backup through File Manager or FTP.
- Repair file permissions and missing configuration files afterward.
- Check database connections if the site still doesn’t load.
Why Website Files Get Deleted in cPanel
Most people don’t wake up planning to remove their own website. It usually happens because several folders look almost identical.
From what I’ve seen, these are the most common causes.
1. Wrong Folder Selected
The public_html directory often contains:
- public_html_old
- public_html_backup
- public_html_new
- public_html_test
Delete the wrong one and suddenly the live website disappears.
2. Recursive Delete
One click on Delete, followed by checking “Skip the trash and permanently delete the files,” removes everything immediately.
That’s probably the checkbox I dislike most inside cPanel.
3. Cleaning Up Old Backups
People often delete folders after migrating a website.
But those folders sometimes still contain:
- images
- uploads
- custom plugins
- configuration files
The website might still depend on them.
4. File Manager Mistakes on Mobile
Editing cPanel from a phone isn’t impossible.
But it’s definitely easier to tap the wrong option.
Signs That Files Were Deleted
Different websites react differently depending on what disappeared.
| Missing Files | Typical Result |
|---|---|
| index.php | Directory listing or 403 error |
| .htaccess | Broken permalinks or redirect loops |
| wp-content | Missing images, plugins, themes |
| configuration.php | Database connection failures |
| Entire public_html | Complete website outage |
Sometimes only one missing file breaks everything.
Step 1 — Don’t Upload Random Files Yet
This sounds obvious.
Don’t start downloading plugins from random places or copying files from another website.
If backups exist, restoring over a half-modified website becomes much harder.
Step 2 — Check File Manager Trash
Many hosting providers keep deleted files in Trash.
Open:
cPanel → File Manager → Trash
If your files are there:
- Select them.
- Click Restore.
- Wait for restoration.
- Reload the website.
You’re done if everything comes back.
Well… sort of. It’s actually more like 90% done because permissions sometimes change after restoration.
Step 3 — Check Hosting Backups
Many hosting companies create automatic backups.
Look for:
- Backup
- Backup Wizard
- JetBackup
- Daily Backups
- Account Backups
Restore:
- Home directory
- public_html
- Specific files
instead of restoring the entire account if possible.
That avoids replacing newer emails or databases.
Which Backup Should You Pick?
If multiple backups exist:
| Backup Age | Usually Safe? |
|---|---|
| Same day | Best choice |
| Yesterday | Usually fine |
| Last week | Good if no recent changes |
| One month old | Only if nothing newer exists |
A newer backup almost always saves more work.
Step 4 — Restore Your Own Backup
If you previously downloaded a backup:
Upload it using:
- File Manager
- FTP
- SFTP
Extract the archive into the correct directory.
Common mistake:
Uploading
website.zipinside
public_htmlwithout extracting it.
The server can’t run a ZIP archive by itself.
Step 5 — Verify Critical Files
Some files cause far bigger problems than others.
Check whether these still exist.
For WordPress:
- index.php
- wp-config.php
- .htaccess
- wp-content
- wp-admin
- wp-includes
For custom PHP websites:
- index.php
- configuration.php
- database.php
- vendor folder
- assets
One forgotten configuration file can make the whole site appear broken.
Step 6 — Fix File Permissions
Restored files sometimes receive incorrect permissions.
Typical values:
Directories:
755Files:
644Configuration files may differ depending on the application.
Don’t blindly change everything to 777.
That suggestion appears all over forums, but it rarely fixes the real problem and creates security issues instead.
Step 7 — Test the Database Connection
Sometimes the files come back but the website still shows:
- Error Establishing Database Connection
- Database Connection Failed
- HTTP 500
Open your configuration file and verify:
- database name
- username
- password
- host
The files may have been restored while the configuration remained outdated.
Step 8 — Check .htaccess
This file gets deleted surprisingly often.
If it’s missing:
WordPress users can usually regenerate it:
Settings
→ Permalinks
→ Save Changes
No edits required.
That refreshes the rewrite rules.
What Actually Worked For Me
One small client site suddenly started returning nothing except a blank page.
At first I thought PHP had crashed.
Then I checked the logs.
Nothing obvious.
I uploaded fresh WordPress core files.
Still broken.
I disabled plugins.
Still nothing.
The actual problem turned out to be much simpler.
I had accidentally removed the entire wp-content/uploads directory while cleaning old backups. The homepage loaded after restoring it from the host’s daily backup. Not 100% sure why I ignored that folder at first, but after staring at file lists for an hour everything starts looking the same.
Since then, I always compare folder sizes before deleting anything.

Advanced Fixes
Check Error Logs
Inside cPanel:
Errors
or
Metrics → Errors
Look for messages like:
Failed opening requiredor
No such file or directoryThose usually point directly to the missing file.
Compare Directory Structure
If you have an old backup:
Compare:
public_htmlagainst
the restored version.
Missing folders often stand out immediately.
Even a small folder containing one autoload file can stop the application from starting.
Check PHP Version
This sounds unrelated.
But after restoring a backup, the hosting account may switch PHP versions.
I’ve seen older backups restored onto accounts now running PHP 8.3 when the site originally used PHP 7.4.
That creates completely different errors which make it look like files are still missing.
Verify Symbolic Links
Less common, but it happens.
Some applications rely on symbolic links.
If the backup restored regular folders instead, assets may disappear even though the files exist.
Look for Partial Restores
Sometimes only half the archive extracts.
You’ll notice:
- missing images
- incomplete plugin folders
- vendor directory partially restored
Delete the incomplete folder and extract the archive again instead of copying files one by one.
Prevention Tips
A few habits save a surprising amount of trouble.
- Download a backup before deleting anything.
- Rename old folders instead of deleting them immediately.
- Keep at least two backup copies.
- Test major cleanup work on a staging site first.
- Double-check you’re inside the correct directory.
- Wait a few days before permanently removing old backups.
- And don’t empty Trash until you’ve confirmed the website still works.
FAQ
Can I recover permanently deleted files in cPanel?
Maybe. If Trash was skipped, your hosting provider’s backups are usually your best option.
My website loads but images disappeared. Why?
The uploads folder was probably deleted or restored incorrectly. That’s much more common than people think.
Does restoring website files restore the database too?
Not always.
Many hosting panels store database backups separately.
Should I reinstall WordPress instead?
Usually no.
Reinstalling the core files doesn’t restore missing uploads, plugins, themes, or configuration files.
I restored everything but still get HTTP 500.
Check:
- PHP version
- file permissions
- error logs
- .htaccess
- missing vendor directory
One of those tends to be the culprit.
Can FTP recover deleted files?
No.
FTP only transfers files. It doesn’t keep deleted copies.
Why did only one page stop working?
That often points to one missing template, image directory, plugin file, or rewrite rule instead of a full website failure.
Editor’s Opinion
Deleting files in cPanel is one of those mistakes almost everybody makes once. Mine wasn’t even on a production site, thankfully. These days I rename folders first and leave them alone for a week. Storage is cheaper than rebuilding a website after one bad click.