Backing up and restoring a WordPress site
A WordPress backup requires both site files and the database. This guide shows how to back up both using cPanel tools, then walks through a complete restore to a subdomain so you can verify it works before relying on it.
Backing up and restoring a WordPress site
You back up a WordPress site by taking two things: the site files and the database. You restore by putting those files back into the right document root and importing the database, then pointing WordPress at it. On Hostworld’s cPanel hosting you can do all of this yourself this afternoon.
This picks up from a cPanel account you can already log in to and a WordPress site that you can reach in a browser.
Before you start
- cPanel includes Backup and Backup Wizard. These let you create and restore partial backups of the Home Directory and individual MySQL databases. You cannot restore a Full Account Backup from within cPanel. Full restores are a provider task through WHM. If you only have a Full Account Backup and want it restored, open a support ticket.
- WordPress lives in two places. Files in your document root hold code, themes, plugins and media uploads. The database stores posts, pages, settings and users. Back up both or you cannot do a complete restore.
- Primary domains usually serve from
public_html. Addon domains and subdomains use their own document roots. Confirm yours before you touch anything. - Restoring a Home Directory backup or using File and Directory Restoration overwrites files with the same names and leaves any extra files that were not in the backup. That can leave a mixed state. Prefer restoring into a clean document root.
- phpMyAdmin exports and imports the database. If the export contains DROP TABLE statements then importing it will delete and recreate tables. Be certain you are using the right database, and make a fresh export of the current database before you import anything.
- Large SQL imports can fail due to PHP limits, with errors such as “POST Content-Length exceeds the limit”. If that happens, you will need to split the import or ask us to raise limits. Do not keep retrying a failing upload.
- Do not rely on WordPress Tools → Export for backups. The XML export is content only. It does not include plugins, themes or uploads.
- Depending on the server profile, Backup Wizard may be disabled for your account. If you do not see it, you can still use File Manager for files and phpMyAdmin for the database. If you are unsure, open a support ticket.
Step 1: Confirm where your site lives
Why this matters: you must copy the right files in and out. Restoring to the wrong directory leaves you with a blank site or a different site on the same account showing by mistake.
- Log in to cPanel for your hosting.
- Open Domains. Find your domain and note its Document Root. For the primary domain, expect
public_html. - Open File Manager and browse to that directory so you recognise what is there now.
Undo: No changes made in this step. Close File Manager if you navigated into sensitive directories and are worried about accidental clicks.
Step 2: Back up your site files
Why this matters: a restore can go wrong. You need a copy you can roll back to. You can use cPanel’s Backup tools or create an archive in File Manager. File Manager is fine for a WordPress site.
Option A: Use File Manager
- In cPanel, open File Manager and go to your document root, for example
public_html. - Select the WordPress folders and files. This typically includes
wp-admin,wp-content,wp-includes, and files likewp-config.php,.htaccessandindex.php. - Click Compress. Choose Zip or Tar GZ. Name the archive with today’s date.
- When the archive appears, click it, then Download to your computer.
- After download, keep a server copy until you have tested your restore plan, but do not leave large archives on the server long term.
Option B: Use Backup or Backup Wizard
- In cPanel, open Backup or Backup Wizard.
- Create a partial backup of the Home Directory. This includes
public_htmland other folders under your home directory. - Download the Home Directory backup to your computer. If your plan supports sending the backup remotely, the destinations available are Home Directory, Remote FTP, Remote FTP Passive and SCP.
Undo: If you created an archive in the wrong place or with the wrong contents, delete that archive in File Manager. If you are short on space, remove old archives after you have verified your latest one works.
Step 3: Back up your database
Why this matters: WordPress stores content and most settings in the database. Files alone are not enough.
- In File Manager, open your document root and view
wp-config.php. Note the values:DB_NAME DB_USER DB_PASSWORD DB_HOST - In cPanel, open phpMyAdmin.
- Click the database named in
DB_NAME. - Click the Export tab. Use the default Quick export to SQL. Download the
.sqlfile. - If you expect to import into a database that already has tables, use Custom export and include “Add DROP TABLE” so the import overwrites existing tables. Keep a copy of the current production database first in case you need to roll back.
Undo: Exports are read only. No undo needed. Keep the export safe and labelled.
Step 4: Prove your backup by restoring to a subdomain
Why this matters: a backup nobody has tested is not a backup. A subdomain gives you a clean place to check you can restore end to end without touching the live site.
- In cPanel, open Domains and create a new domain or subdomain such as
restore.yourdomain.tld. Choose a new document root, for examplerestore. Note that newer cPanel versions create subdomains under Domains rather than a separate Subdomains screen. - In cPanel, open MySQL Database Wizard. Create a new database and a new database user. Give the user all privileges on this database. Record the database name, user and password.
- In File Manager, upload your site files archive into the new document root and use Extract. cPanel can extract server side, which is faster than uploading thousands of individual files.
- In File Manager, copy
wp-config.phpfrom the extracted files and update the database credentials to the new database:
If you are on the same server,DB_NAME DB_USER DB_PASSWORD DB_HOSTDB_HOSTusually does not change. - In cPanel, open phpMyAdmin. Click the new database you created, then Import. Choose the
.sqlfrom Step 3. Start the import. If the file is large and fails with an upload or time limit error, open a support ticket and include the file size and error message. - If the subdomain uses a different URL to your live site, update the site URLs. In phpMyAdmin, open the
wp_optionstable in your restored database. Edit thesiteurlandhomerows to match the subdomain, for examplehttps://restore.yourdomain.tld. - Visit the subdomain in your browser. Log in to WordPress admin. Go to Settings → Permalinks and click Save to regenerate rewrite rules.
Undo: When you have finished testing, remove the subdomain in cPanel Domains, delete its document root in File Manager, and drop the test database and user in MySQL Databases to avoid clutter.
Step 5: Prepare for a live restore safely
Why this matters: live restores can be disruptive if something is wrong. A fast rollback plan saves you time and stress.
- Warn anyone who edits the site to pause while you restore.
- Take a fresh copy of the current live site: compress the current document root in File Manager and export the current database in phpMyAdmin. Label these as “pre-restore”.
- Confirm you have the document root path from Step 1. Do not delete the document root by removing an FTP account. On cPanel, deleting an FTP account that has access to
public_htmlcan remove that directory and take the site offline.
Undo: Your pre-restore archive and database export are your rollback. Keep them until the site is verified after the restore.
Step 6: Restore the files into a clean document root
Why this matters: restoring on top of existing files can leave leftovers that were not in the backup. That produces a mixed state.
Preferred: use File Manager to swap directories
- In File Manager, go to your live document root, for example
public_html. - Rename it to
public_html.pre-restore. This preserves a copy in place for instant rollback. - Create a new empty folder named
public_html. - Upload your site files archive into the new
public_htmland Extract. Confirm key files exist such aswp-config.phpand folders such aswp-content.
Undo: If you need to roll back, rename the new public_html to public_html.failed and rename public_html.pre-restore back to public_html. Remove the failed folder when you are happy.
Alternative: use Backup Wizard Restore for the Home Directory
This restores the whole Home Directory, not only the website. Matching files are overwritten. Files that were not in the backup remain. If you use this, clear or rename the target folders first to avoid leftovers.
- In cPanel, open Backup Wizard. Choose Restore, then Home Directory. Select your Home Directory partial backup and run the restore.
Undo: Use the pre-restore Home Directory archive you took in Step 5 and restore that the same way, or re-swap the directories in File Manager if you preserved them.
Step 7: Restore the database and connect WordPress
Why this matters: the site will not run until WordPress can talk to the right database with the right credentials.
Option A: Restore into a new database and update wp-config.php
- In cPanel, use MySQL Database Wizard to create a new database and user. Grant the user all privileges.
- In phpMyAdmin, select the new database. Click Import and upload your
.sqlfrom Step 3. If the file contains DROP TABLE statements, phpMyAdmin will delete and recreate those tables inside this new database, which is expected. - In File Manager, edit
wp-config.phpin the live document root. Update:
Save the file.DB_NAME DB_USER DB_PASSWORD DB_HOST
Undo: Revert wp-config.php to its previous values and point back to the original database. You can do this by restoring your pre-restore file archive from Step 5 or manually editing the file back.
Option B: Restore into the existing database
- In phpMyAdmin, click the existing database. Use Export to take a backup now.
- Click Import and upload your
.sql. If your export includes “Add DROP TABLE”, the import will delete and recreate existing tables, overwriting current data.
Undo: Import the export you took at the start of this option to put the previous data back.
If the import fails or times out, do not keep retrying the same upload. The limits involved are upload_max_filesize, post_max_size, memory_limit and max_execution_time. Open a support ticket and include the failure message.
Step 8: Fix URLs, permalinks and maintenance
Why this matters: a change of domain or path can trap you in redirects or 404s. Updates can leave the site in maintenance mode.
- If the site’s domain or path changed, update the URLs. In phpMyAdmin, open the restored database, go to
wp_options, edit thesiteurlandhomerows to the correct URL. For wide content changes, use a serialisation safe search and replace method recommended in the WordPress documentation to avoid corrupting stored arrays. - Regenerate permalinks. In WordPress, go to Settings → Permalinks and click Save to flush rewrite rules and update
.htaccess. - If the site says it is under maintenance, in File Manager delete the
.maintenancefile in the document root.
Undo: If a URL change breaks access, revert the siteurl and home values to the old domain in phpMyAdmin. You can also restore your pre-restore files and database from Step 5 to put everything back as it was.
Step 9: Test, tidy and store a safe copy
- Browse the front end and log in to wp-admin. Check media, logins and a few key pages. If you use pretty URLs, confirm they work after saving Permalinks.
- Remove the
public_html.pre-restorefolder when you are satisfied, or keep it briefly if you want a rapid rollback window, then delete it to free space. - Move your fresh working backup off the server. If you want to keep additional copies, cPanel’s Full Backup can send to Home Directory, Remote FTP, Remote FTP Passive or SCP. Remember you cannot restore a Full Backup yourself inside cPanel. It is an archive or migration asset.
- Plan regular backups and test them occasionally. The WordPress project advises keeping multiple recent backups and testing restores periodically.
Undo: If a test fails, use the rollback described earlier: swap the directories back and import your pre-restore database export.
Using a full cPanel account backup
If your only copy is a Full Account Backup, you cannot restore it from within cPanel. You can extract it on your computer and manually upload the contents of homedir/public_html via File Manager, then restore the database using phpMyAdmin as described above. If you want us to perform a full cPanel account restore on our servers, open a support ticket and attach details.
Migrating your site to Hostworld
If you are moving your WordPress site to our cPanel hosting, the restore steps above are the method to bring your files and database over. When you are ready to make the site live on Hostworld, change your domain’s nameservers at your registrar to point to us:
- ns1.serverworld.uk
- ns2.serverworld.uk
- ns3.serverworld.uk
- ns4.serverworld.uk
Allow time for DNS changes to take effect. If you need to undo, switch the nameservers back to the previous values at your registrar while you correct the restore.
What next
If you prefer a click-by-click walkthrough inside cPanel, use our how-to article for backing up and restoring WordPress in cPanel from the Hostworld knowledge base. If you cannot find it or you are stuck at any step, open a support ticket and we will help.
If you are considering moving the site to a VPS so you can control PHP limits and backup schedules, see our VPS guides and the UK plans at UK VPS. For shared and reseller hosting, all site management happens in cPanel as described above.
Common questions
Can I restore a Full Account Backup myself in cPanel?
No. cPanel’s Backup and Backup Wizard only restore partial backups such as the Home Directory and individual databases. Full restores are provider side through WHM. We can restore a full backup for you. Open a support ticket.
Do I need both a files backup and a database backup?
Yes. Files contain WordPress core, themes, plugins and media uploads. The database contains content and settings. A complete restore needs both.
My phpMyAdmin import fails with a size or time error. What can I do?
Large SQL imports can hit PHP limits such as upload_max_filesize, post_max_size, memory_limit and max_execution_time. Export in smaller parts if you can, or open a support ticket so we can advise on limits or perform the import for you.
Will restoring my files delete anything extra on the server?
No. Restores overwrite files with the same names. They do not remove files that did not exist in the backup. This is why restoring into a clean document root is safer. If you restore on top of existing files you can end up with a mixture of old and new.
After restoring to a new domain, my site redirects back to the old one. Why?
The site URLs in the database still point to the old domain. In phpMyAdmin, edit the siteurl and home values in wp_options. If you have many links or media paths to change, use a serialisation safe search and replace method as per the WordPress documentation.
My site is stuck in maintenance mode after an update or restore. How do I fix it?
In File Manager, delete the .maintenance file in the site’s document root. WordPress creates this during updates and removes it after. If the process is interrupted, the file remains and keeps the site in maintenance mode.