Moving a Word Press Site

If you ever need to move your WordPress installation from one server to another, start by reversing the installation process.

Step 1: Download the WordPress files from your server. Make sure you have a complete copy of your wp-config.php and .htaccess files and your wp-content directory.

Step 2: Export your database. If you have installed any plugins that create new tables, be sure to include them in your backup. They will share the prefix (e.g. 'wp_') you specified during the installation. You can install Austin Matzko's WP-DB-Backup plugin or use your host's control panel (e.g. PHPMyAdmin) to export your WordPress database.

Step 3: Put your old site into maintenance mode so your visitors can't continue to submit comments and trackbacks to your old database. Michael Wohrer's Maintenance Mode plugin works well.

Step 4: Edit your wp-config.php file. Change the database connection settings to correspond with the values on your new server. You should also define your site and blog URLs in the configuration file, as shown in Listing 2-4. This will override the settings in your database so you can log in on your new server. (Otherwise, WordPress would constantly redirect you to your old site!) See codex.wordpress.org/Editing_wp-config.php for details on these and other advanced configuration settings.

Listing 2-4: Overriding database values for your site URLs in wp-config.php define('WP_SITEURL', 'http://example.com); define('WP_HOME', 'http://example.com');

Step 5: Upload your files, including the modified wp-config.php, to your new web server. Step 6: Import the database backup you made in Step 2 to your database on your new server using your new web host's control panel tools.

Step 7: Log in to your WordPress site at its new location (e.g. example.com/wp-admin). Step 8: If you changed your site's URL, your posts and pages probably contain many hardcoded paths to your uploaded media files. Use the Search and Replace plugin to change these to your new URL, as shown in Figure 2-22.

Figure 2-22. Replacing URLs with the Search & Replace plugin.
0 0

Post a comment