• Skip to primary navigation
  • Skip to content
  • Skip to primary sidebar

HANDS ON WORDPRESS

Making a Living with WordPress

  • Home
  • Blog
  • About
    • About Hands On WordPress
  • The Austin WordPress Community
  • Contact
  • Show Search
Hide Search
You are here: Home / WordPress / Move and Restore Your WordPress Site

Move and Restore Your WordPress Site

Nick Batik · August 12, 2011 · Leave a Comment

There are times when you need to move WordPress around within your server, and times when you need to move WordPress from one server to another. You don’t need to reinstall. WordPress is flexible enough to handle all of these situations.

In this article we show you how to move your website. We show you a variety of options – some easy, some much more complicated – because we don’t know the specifics of your circumstances, or your skill level. Start with the easy methods. If those don’t give you the results you expect, try something a bit more advanced.

Easy answer for most installations:Moving WordPress

  • If database and URL remains the same, you can move by just copying your files and database.
  • If database name or user changes, edit wp-config.php to have the correct values.
  • If you want to test before you switch, you must temporarily change “siteurl” and “home” in the database table “wp_options” (through phpMyAdmin or similar).
If you had any kind of rewrites (permalinks) setup you must disable .htaccess and reconfigure permalinks when it goes live.

Moving WordPress Within Your Site

Moving the WordPress files from one location on your server to another – changing its URL – requires some special care.
Here are the step-by-step instructions:

Create the new location using one of these two options:

  1. 1. If you will be moving your WordPress core files to a new directory, create the new directory.
  2. If you want to move WordPress to your root directory, make sure all index.php, .htaccess, and other files that might be copied over are backed up and/or moved, and that the root directory is ready for the new WordPress files.
  3. Login to your blog.
  4. Go to the Administration > Settings > General panel.
  5. In the box for WordPress address (URI): change the address to the new location of your main WordPress core files.
  6. In the box for Blog address (URI): change the address to the new location, which should match the WordPress address (URI).
  7. Click Save Settings.
  8. (Do not try to open/view your blog now!)
  9. WordPress 2.0 only: Delete the folder wp-content/cache.
  10. Move your WordPress core files to the new location. This includes the files found within the original directory, such as http://example.com/wordpress, and all the sub-directories, to the new location.
  11. If you are using Permalinks, go to the Administration > Settings > Permalinks panel and update your Permalink structure to your .htaccess file, which should be in the same directory as the main index.php file.
  12. If you have problems with missing images that you’ve uploaded, you need to change the path to the images on every post directly on your SQL database. For this, follow the instructions on Tamba2’s Tutorial “Moving your weblog inside your PC”.
  13. You must also check and edit ‘store uploads folder’ under Settings > Media or all your new uploads will continue to go into the old folder.
  14. Existing image/media links uploaded media will refer to the old folder and must be updated with the new location.
  15. In some cases your permissions may have changed, depending on your ISP. Watch for any files with “0000” permissions and change them back to “0644”.
  16. If your theme supports menus, links to your home page may still have the old subdirectory embedded in them. Go to Appearance::Menus and update them.
  17. Sometimes you would need to restart your server, otherwise your server may give out an error. (happens in MAMP software (Mac)).
  18. It is important that you set the URI locations BEFORE you move the files.

If you forget to change the locations

Suppose you accidentally moved the files before you changed the URIs: you have two options.

OPTION 1. Suppose the files were originally in /path/to/old/ and you moved them to /path/to/new before changing the URIs. The way to fix this would be to make /path/to/old/ a symlink (for Windows users, “symlink” is equivalent to “shortcut”) to /path/to/new/, i.e.
ln -s /path/to/new /path/to/old
and then follow the steps above as normal. Afterwards delete the symlink if you want.

OPTION 2. If you forget to change the WordPress Address and Blog Address, you will be unable to change it using the wordpress interface. However, you can fix it if you have access to the database. Go to the database of your blog and find the wp_options table. This table stores all the options that you can set in the interface. The WordPress Address and Blog Address are stored as siteurl and home (the option_name field). All you have to do is change the option_value field to the correct URL for the records with option_name=’siteurl‘ or option_name=’home‘.

If you have accidentally changed your WordPress site URL

Suppose you accidentally changed the URIs where you cannot move the files. (but still can access the login page, through a redirection or something)
wp-login.php can be used to (re-)set the URIs (Insert the following lines after

require( dirname(__FILE__) . '/wp-load.php' );
//FIXME: do comment/remove these hack lines. (once the database is updated)
 update_option('siteurl', 'http://your.domain.name/the/path' );
 update_option('home', 'http://your.domain.name/the/path' );

You’re done. Test your site to make sure that it works right. If the change involves a new address for your blog, make sure you let people know the new address, and consider adding some redirection instructions in your .htaccess file to guide visitors to the new location.
Changing The Site URL also provides the details of this process!

Moving WordPress Multisite

Multisite is far more complicated to move, as the database itself has multiple references to the server name as well as the folder locations.
The best way to move Multisite is to move the files, edit the .htaccess and wp-config.php (if the folder name containing Multisite changed), and then manually edit the database. Search for all instances of your domain name, and change them as needed. This step cannot yet be easily automated. If you’re moving Multisite from one folder to another, you will need to make sure you edit the wp_blogs entries to change the folder name correctly.

Moving WordPress to a New Server

If you are moving WordPress from one server to another, begin by backing up your data. This includes backing up your WordPress database as well as all the core files, images, plugins, and other files on your site. See WordPress Backups and Backing Up Your Database for more details.
• Note: If you are changing to a new server but same domain, all you need to do is edit wp-config.php and upload everything as it is to your new server.

If You Don’t Care If Your Old Blog Works

  1. Download a copy of the main wordpress files from your OLD blog to your hard drive and edit wp-config.php to suit the new server.
  2. Go back to your OLD blog and go to Administration > Settings > General and change the url (both of them) to that of your new site.
  3. Again, download your database (but keep the old one just in case), upload this new database and the copy of the wordpress core files with the edited wp-config.php to your new server. Thats it!

If You Want Your Old Blog To Still Work

Caution: Make sure you have a backup of your old blog’s WordPress database before proceeding!

Part A – Activating Your New Blog

  1. Download your entire WordPress installation to your hard drive. Name the folder appropriately to indicate that this is your OLD blog’s installation.
  2. Go back to your OLD blog and go to options and change the url (both of them) to that of your new site.
  3. Again, download your entire WordPress installation to your hard drive. Name the folder appropriately to indicate that this is your NEW blog’s installation.
  4. Download your database once again (but keep the old one). Upload this database to your new server. It will be easiest if you use the same database name and you create a user with the same login credentials on your new server as on your old server.
  5. If you used a different database name and/or user (see previous step), edit wp-config.php in your NEW blog’s installation folder appropriately.
  6. Upload the NEW blog’s installation folder to your new site. Presto, your NEW blog should be working!

Part B – Restoring Your Old Blog

  1. On the original server, delete your OLD blog’s database (remember, you should have a copy on your local computer that you made at the very beginning).
  2. Upload your OLD blog’s installation folder to your original server, overwriting the files that are currently there (you may also delete the installation folder on the server and simply re-upload the OLD blog’s files).
  3. Upload your OLD blog’s database from your local computer to the server. That should do it!

Another procedure for making copies of posts, comments, pages, categories and custom field (post status, data, permalinks, ping status…) easy to follow:

  1. Install a new WordPress blog
  2. Go on old blog Admin panel. Here, in Manage > Export select “all” in menu Restrict Author.
  3. Click on Download Export File
  4. In new blog go on Manage > Import, choose WordPress item.
  5. In the page that will be shown, select the file just exported. Click on Upload file and Import
  6. It will appear a page. In Assign Authors, assign the author to users that already exist or create new ones.
  7. Click on Submit
  8. At the end, click on Have fun

Note: using this method if there are some articles in new blog (like hello world, info page…), these will not be erased. Articles are only added. Using the former procedure the article in new blog will be deleted.

Moving WordPress to a New Server with Fantastico

Some webhosts use a service called Fantastico, which can install a vanilla WordPress web with just a few clicks. You can transfer your blog to one of these webs, but the steps are slightly different.

Begin by backing up your data. This includes backing up your WordPress database as well as all the core files, images, plugins, and other files on your site. See WordPress Backups and Backing Up Your Database for more details.

Make a copy of your database. You will need to edit the .sql file, and in case of errors, it is important that you work on a copy.
Begin the process of working from copies of your backups.

If you have changed domain, edit the backed up database file to reflect this. A simple way to do this is:

  1. Using a text editor, open a copy of the .sql database file.
  2. Using the search and replace function, find all instances of the blog’s old URL and replace it with the new URL.
  3. Repeat the process with your old email address. (For example, replacing someone@example.com with someone@tutorial.com)
  4. Save your changes.
  5. Upload your plugins and themes from your old site to the new one.
  6. Drop (delete) the database tables of the pre-installed Fantastico web.
  7. Restore the database.

When you are ready to check your site, make sure to clear your cache and cookies so you will see the changes in your web browser.

Site Management and Site Moving Services

There has been a growth of services that help you manage updates, backups, and even help you move your site to other hosting services.

One of these is ManageWP. We personally like this service so much, we use it for our own sites, and we are an affiliate.

Their documentation includes detailed instructions on how to move your website.

 

Filed Under: WordPress Tagged With: Move and Restore WordPress Site

Reader Interactions

Leave a Reply Cancel reply

Your email address will not be published. Required fields are marked *

Primary Sidebar

About Sandi Batik

About Sandi Batik

Introverted Freelancer, WordPress trainer, consultant, curricula developer, author, unapologetic geek, unrepentant capitalist, lucky enough to do what I love … more about me about About Sandi Batik

  • Twitter

Search

Introverted Freelancer

Traits of Successful Introverted Freelancers

Traits of Successful Introverted Freelancers

2017 Business Check-up Workshop

2017 Business Check-up Workshop

Expanding Your Business With Automated Marketing Funnels

Expanding Your Business With Automated Marketing Funnels

How to Use Permission Marketing to Build Your WordPress Business

How to Use Permission Marketing to Build Your WordPress Business

How Much Should I Charge for Building or Designing a WordPress Website?

How Much Should I Charge for Building or Designing a WordPress Website?

Project Management

Keeping Scope Creep From Killing Your Schedule and Profit Margin

Keeping Scope Creep From Killing Your Schedule and Profit Margin

Project Management for WordPress Freelancers

Project Management for WordPress Freelancers

WordPress

Securing and Maintaining Your WordPress Site

Securing and Maintaining Your WordPress Site

How The WordPress Media Library Works — 2018

How The WordPress Media Library Works — 2018

How To Build an Information Structure for Your WordPress Site

How To Build an Information Structure for Your WordPress Site

How WordPress Themes Really Work

How WordPress Themes Really Work

How to Create and Manage eMail Newsletters from Your WordPress Site

How to Create and Manage eMail Newsletters from Your WordPress Site

How to Secure and Maintain Your WordPress Site

How to Secure and Maintain Your WordPress Site

Copyright © 2010-2023 Hands On WordPress · All Rights Reserved