in

How to Restore a Website After Accidentally Deleting Files in cPanel

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 FilesTypical Result
index.phpDirectory listing or 403 error
.htaccessBroken permalinks or redirect loops
wp-contentMissing images, plugins, themes
configuration.phpDatabase connection failures
Entire public_htmlComplete 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:

  1. Select them.
  2. Click Restore.
  3. Wait for restoration.
  4. 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 AgeUsually Safe?
Same dayBest choice
YesterdayUsually fine
Last weekGood if no recent changes
One month oldOnly 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.zip

inside

public_html

without 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:

755

Files:

644

Configuration 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.

 Restore a Website After Accidentally Deleting Files in cPanel

Advanced Fixes

Check Error Logs

Inside cPanel:

Errors

or

Metrics → Errors

Look for messages like:

Failed opening required

or

No such file or directory

Those usually point directly to the missing file.


Compare Directory Structure

If you have an old backup:

Compare:

public_html

against

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.

Written by ugur

Ugur is an editor and writer at (NSF Tech), specializing in technology and Windows. He produces in-depth, well-researched, and reliable stories with a strong focus on Windows, emerging technologies, digital culture, cybersecurity, AI developments, and innovative solutions shaping the future. His work aims to inform, inspire, and engage readers worldwide with accurate reporting and a clear editorial voice.

Contact: [email protected]