Restore wordpress site from backup

Professional WordPress Advice & Support for Free Forums General Support Restore wordpress site from backup

  • Author
  • #143 Reply

    I have a backup taken with “wp export” and I have the tar.gz of the site public_html folder. How to use those on a brand new server to restore an identical website. Thanks

    #145 Reply

    Hey Amine, welcome to WorP’Dev. I’m Nabil, The WordPress Developer. I will be glad to assist you.

    Since you don’t have a database backup, you won’t be able to create an exact copy of the previous website. The database contains important data such as website, plugin and theme options, posts metadata, etc.

    Here is how I would do it:

    STEP 1 – Prepare a WordPress Installation

    1. Install WordPress normally on the new server.
    2. Extract the uploads folder (.../wp-content/uploads/) from the tar.gz file and copy its contents into the new website’s uploads folder.
    3. Do the same with the wp-content/themes and wp-content/plugins folders.
    4. Go to your dashboard and enable the theme you want to use and the plugins you still want to use. Feel free to delete the ones you no longer want.

    STEP 2 – Prepare the WXR File

    1. Open (a copy of) the WXR file and do a search and replace, you need to replace the old website URL with the new one. We need to do that so that the WordPress Importer can find the attachments and can import them.
    2. Once you do the search and replace, look for an occurrence of the attachment_url XML element which contains the new URL and test the URL in the browser, it should show the image.
    3. Test another few (2 or 3) URLs just to make sure they are correct then save the new copy of the WXR file.

    STEP 3 – Import with the WordPress Importer

    1. In your dashboard, go to “Tools > Import”.
    2. Under “WordPress,” if you haven’t already installed the importer, click “Install Now.”
    3. Click the “Run Importer”, provide the WXR file then click “Upload file and import.”

    Give this a try and let me know if you need further assistance.

    #192 Reply

    Subscriptions were not working earlier today, so you may have missed my previous reply.

    #194 Reply

    Thank you. Actually I have a db backup and the website url will remain the same

    #196 Reply

    That makes things easier.

    Step #1 – Restore Files

    The first thing you need to do is to extract the tar.gz backup into the new website root folder. When you do that and access you website, you should see the error message “Error establishing a database connection”, don’t worry about that message, it will go away after Step 3.

    Step #2 – Restore Database

    Create a database if you don’t already have one, then import the SQL file into it. The easiest way to do the import is to use phpMyAdmin, it’s most probably already available if you have cPanel.

    Step #3 – Tell the WordPress Site about the Database

    Open the wp-config.php file and update the database connection information.

    This should do the trick. Let me know if you need more help.

Reply To: Restore wordpress site from backup
Your information: