What the correct way of backing and restoring wordpress (9 posts)

  1. hiboy
    Posted 3 years ago #

    Hi, I been with wordpress for a year,yet ashamed to say this, till now i am unsure of how to backup and restore wordpress correctly.
    Imagine backing up of blog.domain.com and restoring to story.domain.com
    Here what i did ,
    step 1 - backup all files (wp-admin,wp-contents etc) and the .sql database from blog.domain.com
    (did i do step 1 correctly?, cause this is what i always do to backup each websites, and i have 30 website files and .sql)
    step 2 - upload all files (except wp-config.php) and upload the .sql database to story.domain.com
    Here's the problem. My site would seem wierd or white screen when i navigate to it.
    Step 3 - I heard from some user that i have to change the site url,and home url. What i did was when to phpmyadmin, change the site url and home url from blog.domain.com to story.domain.com in the .sql. Tried this but the site still become white screen.
    Here is where i am stuck always.

    Kindly go through and correct me which step i did till correctly
    Thank you.

  2. jibbius
    Posted 3 years ago #

    First off, check out the BackupBuddy plugin.
    It will do everything, and you won't need to think twice about it.

    BUT - This is how I would do it manually:
    - Install wordpress at new location.
    - Check the values of: siteurl and home in wp_options table. You will need these later.
    - Drop all tables from the new database, replace them with the tables in your backup.
    - Copy the wp-content folder to new site.

    Run this SQL (replacing the old/new urls):

    UPDATE wp_options
    SET option_value = replace(option_value, 'http://old.url', 'http://new.url')
    WHERE option_name = 'home' OR option_name = 'siteurl';
    UPDATE wp_posts
    SET post_content = replace(post_content, 'http://old.url', 'http://new.url');
  3. hiboy
    Posted 3 years ago #

    Hi jibbius, thanks for your reply , yes i understand there are many backup plugin available, but i wish to understand the basic of backup manually which i failed to,

    your step seem to be what I have done, as such ,
    - Install wordpress at new location.
    - Drop all tables from the new database, replace them with the tables in your backup.
    - Copy the wp-content folder to new site.( i copy the whole files except wp-config.php) didnt realise wp-content is enough
    and manually change the url in siteurl and home in wp_options table

    are these the steps ,did i miss out any??
    I backup my blog.domain.com, and upload to localhost/story, when i navigate to it, a white screen

  4. skapator
    Posted 3 years ago #

    This should pretty much cover all your questions


    Note that there is a problem with widgets when changing domains, check this for more info and solution


  5. hiboy
    Posted 3 years ago #

    Hi skapator, thanks for your reply
    I was given this url http://codex.wordpress.org/Moving_WordPress before hand and have given it a read thoroughly

    not sure what step i might miss out that my backup and restoration is not complete.
    Seem like it complicated to manually backup, any solution?

  6. jibbius
    Posted 3 years ago #

    You havent missed any steps.
    You may have made a mistake somewhere though?

    Localhost install can be more complicated.
    You may need to write your url with a port number - e.g. http://localhost:8888/newurl

    If you are running wordpress locally, try downloading the free version of ServerPress DesktopServer.
    It works on Mac/Windows/...etc
    It also creates records in your hosts file; this may fix the whitescreen problem.

  7. hiboy
    Posted 3 years ago #

    hmm, hi jibbius , thanks for your reply,

    i running on xampp ,so it should be localhost/story, hmm, i guess i try again,
    the previous time i tried backing and restore was an horror too, after i backup ,restore and change the url in database, the whole site does not have a white screen,but just words and images, and the site was mess up,when i navigate to the backend ,it redirect to the old url frontend, unsure why too


  8. jibbius
    Posted 3 years ago #

    To ellaborate.
    - Try creating your local install via ServerPress: http://serverpress.com/downloads/
    - Repeat the steps above, except you may need to upgrade the new local wordpress (so old & new are the same version prior to copying database).
    - This will create a url in the format http://www.example.dev
    - You can access phpadmin via http://www.example.dev/phpmyadmin

    I think there is a problem with your home/siteurl.
    Localhost urls can be different with different webservers & webserver config.
    Using a tool like serverpress will significantly reduce the time you try to spend fixing / debugging this.

  9. skapator
    Posted 3 years ago #

    Can you try this? :

    1. backup wp files
    2. backup database

    3. download notepad++ ( http://notepad-plus-plus.org/ )

    4. open sql file with notepad++ and hit ctr+f to open the search and replace.

    5. replace http://blog.domain.com with http://story.domain.com and hit replace all. Save it.

    6. create a new database and user and upload the sql file

    7. upload the wp files.

    8. open wp-config and replace :

    define('DB_NAME', '*YOUR_DB_NAME*');
    /** MySQL database username */
    define('DB_USER', '*YOUR_DB_USER*');
    /** MySQL database password */
    define('DB_PASSWORD', '*YOUR_DB_PASS*');

    Is this something that you already tried?

Topic Closed

This topic has been closed to new replies.

About this Topic


No tags yet.