Most of the times we are working on staging server for different projects. Once done with development, we move everything to live. Specifically with wordpress, this is bit complicated as wordpress store almost all data in database. For example it stores site url in database. So we can’t simply move the code & database to live and expect the wordpress project to run perfectly fine. To make things little bit simpler, we can take care of the following things.
Lets assume that our staging site is stage.abc.com where as live site is abc.com and you have already moved the codebase and database.
- open the database and search for stage.abc.com through out the database. You will mainly find this in two tables post table and options table. For this moment, replace the above stage url with the live url in the options table so that we can at least access our site with the live url. For taking care of post table, we have a better option.
- use wordpress search & replace plugin. this provides an easy interface to search for any specific term (stage url) with another term (live url). By using this we can cover up most of the tables.
With the above 2 steps we can easily move a wordpress project.
This is the best possible solution as long as we are using the same table prefix. As the name suggests, table prefix is used for wordpress table names (also for some other cms like Joomla). By using this we can install multiple wordpress projects in a single database. It means we can have one wordpress installation with prefix as “wp_” another one as “wp1_” both in the same database. Whatever steps we have followed above for moving sites will partially work if we are moving the stage database to a different table prefix(wp1_) as compared to the staging one(wp_). Partial in the sense you can access the website but some other functioanlities such as admin end will not work and without admin end, wordpres will be of no use. But no need to worry. We also have a solution to this problem. 🙂
- Follow the top 2 steps as mentioned earlier.
- As already mentioned wordpress stores most of the data in tables, it stores some field values which are related to table prefix.
One thought on “WordPress Site Migration Tips”
very interesting details you have mentioned , regards for putting up.