Skip to content

WordPress Tips: moving site to another server

With this article we continue to share our experience of implementation the websites with free popular engines like WordPress, Drupal, Joomla etc. After delivering hundreds of such projects to the clients we collected number of tips/solutions which we think may be useful for other developers or clients. If you are interested in solutions to some problems you faced with please feel free to contact us – we’ll try to cover them as well.

If you ever tried to develop the WordPress sites you most probably faced with the problem we are describing. When you develop a WordPress site there is 99,9% chance that after development you need to move it from one server to another and even not just once. At the first glance there are no issues for more or less experienced developer – you just copy files and database to the new server and update config file with correct settings. After that you open your home page and see it working – so everything looks ok, but when you start clicking through the site you may be redirected to your initial domain (your development version) or extra folders may appear in your links so that the links are incorrect.

Why is that happening? The answer is simple – during the installation WordPress saves base URL in its settings and in many places including posts/pages content it saves absolute URL’s in database. This means that after you moved the site you should update URL’s in many different places, which involves extra work for you every time you need to move site. Also this makes very difficult delivering the project files to the client in case the client wants to install the site manually.

In order to solve this problem we have developed a simple PHP script which perfoms all the required actions automatically, you just need to copy it to the WordPress folder, run and follow the onscreen instructions. Below is detailed step-by-step tutorial.

  1. Upload wp-host-update.php file to your WordPress root folder
  2. Point your browser to this script by pasting http://yourdomain.com/wp-folder/wp-host-update.php to the browser address bar, replacing “yourdomain.com” and “wp-folder” by your real values
    wphostupdate1 300x271 WordPress Tips: moving site to another server
  3. The script will try to determine and pre-fill the values for your server, in most cases you don’t need to change them. After you made sure they are correct click “Update” button. If everything went well you should see a screen like:
    wphostupdate2 300x271 WordPress Tips: moving site to another server
  4. You are done and may enjoy your WordPress site at another server.

Notes: If you use permalinks you should go to the WP admin panel and update permalinks structure after running the script.

Important: We recommend you to backup your database before running wp-host-update.php. Investing in reliable managed server hosting is well worth the cost as it usually have automatic backup options and convenient control panel.

Download: To download our script file please click here.

You are free to use and modify our script for information but please don’t remove our copyright information.

For those technical people who are concerned about other data in your WordPress tables here is short information on what happens inside the script. We do the following actions:

  1. Replace the options “siteurl”, “admin_email”, “upload_path” in the “wp_options” table
  2. Update fields “guid”, “post_content ” in the “wp_posts” table, also update “wp_postmeta” table

7 Responses to “WordPress Tips: moving site to another server”

  1. Mladen May 19th, 2010 at 11:35 am

    Hi there,

    thank you very much for the script. It would be nice to use long form PHP open tags in eventual update since they always work. Short version <? and <?= is not always available, it has to be enabled in php.ini which can be a problem to some WP users…

    WBR,
    Mladen

  2. Jim Kendrick September 2nd, 2010 at 3:27 pm

    I built my site on MAMP, then tore out my hair trying to upload it to a real server. I carefully followed several “tutorials,” only to discover broken links, lost color and bum navigation. Your solution came the closest to fixing it and restored my sanity.
    All I have to do is fix my background color and rebuild the navbar from my pages. Thanks so much!!

  3. blog November 1st, 2010 at 1:53 pm

    bookmarked your blog thanks :)

  4. JC April 28th, 2011 at 9:22 am

    To download our script file please click here This link is broken. Is there a new link to the file?

  5. JC April 28th, 2011 at 9:24 am

    I don’t think my last post was to clear. You have apost with a link to wp-host-update.php script. The link doesn’t work. Is there a good link?
    Thanks

  6. Alex Prokopenko May 12th, 2011 at 3:29 pm

    We’re very sorry our server was down for some time. Now the link works again. You can try to download it.

Leave a Reply

3d Party Adobe Flash Api Blog CMS Compatibility Cross Browser CSS Drupal FB Portfolio Custom FF Google Google Gears Html Code IE6 IE7 Implementation Javascript Libraries Joomla Jquery Kharkov Management Systems Multi color sIFR Open Source Cms Opera Optimization PHP Plugins Plug Ins PSD to Drupal psd to html PSD to Magento PSD to Wordpress Safari Semantics sIFR Templates W3c Standards Widget Example Widget Name Widgets Wordpress Wordpress Theme WP Xhtml