Moving WordPress
This howto will explain how to move WordPress from one domain or server to another with about 5 minutes worth of work.
Applicable to Centos Versions:
- Centos 5.x
- Centos 6.x
Requirements
Explanation of requirements.
- Admin or root access to the old or existing website, database, database dump and files.
- Admin or root access to the new server.
- A basic understanding of Linux, Mysql and WordPress.
Doing the Work
This howto assumes your domain name already resolves to the new server and you’ve already uploaded the core WordPress files, custom themes and any plugins in to the proper httpd docroot.
- Take a mysqldump of the database to be moved and save it locally.
- Change the old WordPress Address (URL) and Site Address (URL) in the database using sed.
- Edit wp-config.php
mysqldump -u root -pmypass mydatabase > mydatabase.sql replace "mypass" with your password, no spaces between your password and the -p
sed -i 's/example1.com/example2.net/g' example_wpdb.sql In this example we're replacing any occurance of "exmaple1.com" with "example2.net" in the example_wpdb.sql database. a. Create a new empty mysql database with the same name as the one you're importing on the target server. b. Import this new, edited database on the new target server.
Add this on a separate line by itself near the end of the wp-config.php file after all the other "define" statements:
define('RELOCATE',true);
a. Save and upload wp-config.php to the new server.
b. Load the site, login to the wp-admin
c. Go to: settings --> general and make sure the addresses are correct.
d. Again, edit the wp-config.php and remove completely or comment out the previously added define statement like this:
/*define('RELOCATE',true);*/
Troubleshooting / How To Test
Explanation troubleshooting basics and expectations.
- Take a good look at the steps above and make sure you’ve followed them in precise order.
Stop where things stop working as expected and take note of any error or unexpected output or behaviors. Also make sure to be prepared with your: Linux version httpd(Apache) version php version MySQL version
Common problems and fixes
Disclaimer
We test this stuff on our own machines, really we do. But you may run into problems, if you do, come to #centoshelp or #wordpress on irc.freenode.net


