How to Move WordPress

Moving WordPress is fairly easy, but it needs careful attention. The key point of WordPress directory change is to modify URL settings through the admin page and/or to change DB user information through “wp-config.php”. In most cases, re-installation is not necessary.

Moving WordPress Case by Case
1. Move WordPress to a new directory within the same website.
2. Move WordPress to an existing directory (including the root directory) within the same website.
3. Move WordPress to a new server with the same domain and the same directory.
4. Move WordPress to a new server with a different domain or a different directory.
5. Use WordPress plug-ins or tools to export and import data.
6. Update the internal links of the existing posts if necessary.
7. Modify the 404 page if necessary to indicated that some files may be missing because of directory change.
8. Manual update of the blog URLs using MySql queries.

In any case, backup is essential!

1. Move WordPress to a new directory within the same website.

    Example) www.mydomain.com/blog -> www.mydomain.com/newblog
    (1) Create the designation directory ‘newblog’.
    (2) Log in to your WordPress blog admin interface.
    (3) Click Settings, and it should display General Settings.
    (4) Change the value of WordPress address (URL).
    (5) Change the value of Blog address.
    (6) Save the changes.
    (7) Delete the folder “wp-content/cache” if your WordPress is 2.0.
    (8) Move all the files (including files under the sub-directories) to the new directory. (You can do this via FTP software or you can download everything to your computer and upload everything to the new directory. Either case, you need some FTP tool or an admin tool.)
    (9) If you’re using customized Permalinks, change Permalinks appropriately. Go to Settings -> Permalinks.
    * It’s important to change the blog URL configurations first before you actually move the files.

to the top

2. Move WordPress to an existing directory within the same website. This includes moving WordPress directory to the root directory. It’s going to overwrite the destination files when their names are the same.

    Example) www.mydomain.com/blog -> www.mydomain.com/
    (1) Back up all the files of the destination directory. Backup is critical. If the destination directory is the root directory, make sure you back up all files including the index file - such as index.php, index.html, or index.htm - and .htaccess.
    (2) Follow the steps from 2 to 9 of the above case.
    (3) If you’re concerned about broken links because of the moving, change WordPress 404 page to inform some files may have been moved.
    * It’s important to change the blog URL configurations first before you actually move the files.

to the top

3. Move WordPress to a new server with the same domain and the same directory.

    Example) www.myblog.com (hosting company A) -> www.myblog.com (hosting company B)
    (1) Back up all the data and the files including images, themes, and plugins.
    (2) Change DB settings by editing wp-config.php. Editing this configuration file is not necessary if you can set up the exact same DB name, user name and password on the new server. In most cases, they are different. Upload everything to the new server including “wp-config.php”.
    (3) Import the data to the new database of the new server. Many hosting companies provide a GUI account control panel that includes phpMyAdmin, MySql tool to run queries. Import data by clicking “Import” from the top menu of the right frame of phpMyAdmin. If you don’t feel comfortable, use WordPress plug-ins to move data or ask for a professional help.

to the top

4. Move WordPress to a new server with a different domain or a different directory.

    Example1) www.myblog.com (hosting company A) -> www.justmoved.com (hosting company B)
    Example2) www.myblog.com (hosting company A) -> www.myblog.com/newbeginning (hosting company B)
    (1) Log in to your WordPress blog admin from the old server (hosting company A).
    (3) Click Settings, and it should display General Settings.
    (4) Change the value of WordPress address (URL) to the new location.
    (5) Change the value of Blog address to the new location.
    (6) Save the changes.
    (7) Download all the data and the files including images, themes, and plug-ins to your computer.
    (8) Change DB settings by editing wp-config.php that you just downloaded to your computer. Editing this configuration file is not necessary if you can set up the exact same DB name, user name and password on the new server. In most cases, they are different. Upload everything to the new server including “wp-config.php”.
    (9) Upload all the files to the new server (hosting company B).
    (10) Import the data to the new database of the new server. Many hosting companies provide a GUI account control panel that includes phpMyAdmin, MySql tool to run queries. Import data by clicking Import from the top menu of the right frame of phpMyAdmin. If you don’t feel comfortable, use WordPress plug-ins to move data or ask for a professional help.

to the top

5. Use WordPress plug-ins or tools to export and import data. If you don’t feel comfortable to run queries, use this WordPress plug-in.

WP-DB-Backup
This tool allows you to back up WordPress DB data without using phpMyAdmin or command lines.

to the top

6. Update the internal links of the existing posts if necessary. The internal links within the existing posts and pages should be manually updated when they use absolute URLs. Otherwise, they still point to old locations.

Example) www.mydomain/oldblog/tips/how-to-move-wordpress.html
-> www.mydomain.com/newblog/tips/how-to-move-wordpress.html

Run this MySql query using phpMyAdmin or other DB tools.

UPDATE wp_posts SET post_content = replace(post_content, ‘http:// www.mydomain/oldblog ‘, ‘http:// www.mydomain/newblog);

to the top

7. Modify the 404 page if necessary to indicated that some files may be missing because of directory change.

Via WordPress Admin: Design -> Theme Editor -> 404 Template or
Via FTP: wp-content/themes/yourtheme/404.php
Example) http://www.free-ebusinesshelp.com/example-404page.html

to the top

8. In case that the blog URLs have not been changed, you can run this MySql query and manually update them.

UPDATE wp_options SET option_value = replace(option_value, ‘http://www.oldblog.com’, ‘http://www.newblog.com’) WHERE option_name = ‘home’ OR option_name = ’siteurl’;

to the top

No Comments

Leave a comment