PCI Compliant Web Hosting and Managed Service Provider
Hosting Solutions since 1995

Moving your WordPress Site from a development subdomain to a domain

Author: ; Published: May 22, 2011; Category: Managed Hosting, WordPress; Tags: ; One Comment

We encourage our managed shared hosting customers to develop new WordPress sites on a subdomain off of their main domain — for example, dev.your_domain_name.com — and test it out, prior to making their site live. So now, you have a fully developed site at dev.your_domain_name.com, and you want to move it to www.your_domain_name.com; now what?

This takes three simple steps using ftp, phpMyAdmin, and editing your wp-config.php file.

Use FTP to archive (backup) your main site, and then delete all contents except for awstats, cgi-bin, cgi-local, cp, and webalizer; when in doubt as to what to delete, contact our customer support department.

Then upload your WordPress site from your dev.your_domain_name.com to your_domain_name.com.

In phpMyAdmin run the following two SQL queries replacing dev.your_domain_name.com with the full subdomain name you were using and modifying www.your_domain_name.com with your domain name including the “www.” subdomain prefix:

 

UPDATE wp_options SET option_value = replace(option_value, 'http://dev.your_domain_name.com', 'http://www.your_domain_name.com') WHERE option_name = 'home' OR option_name = 'siteurl';

UPDATE wp_posts SET post_content = replace(post_content, 'http://dev.your_domain_name.com', 'http://www.your_domain_name.com');

 

NOTE:  There are two best options for running the above mySQL SQL statements:  (1) via phpMyAdmin or (2) reviewing the wp-config.php file for the mysql login credentials and then using “mysql -H [mysql host without brackets] -u [mysql user name without brackets] -p[mysql password — no space after the minus p — without brackets] [mysql database name without brakets]” via SSH.

Then edit your wp-config.php file and place the following two lines (again replacing dev.your_domain_name.com with the full subdomain name you were using and modifying www.your_domain_name.com with your domain name including the “www.” subdomain prefix) right after the initial comment —

 

/* @package WordPress */ :

define('WP_HOME','http://www.your_domain_name.com');

define('WP_SITEURL','http://www.your_domain_name.com');

 

That’s it; now browse your new site, and double check the WordPress back end of your new site.

Since we take our managed hosting seriously, if you don’t have time for the above steps or you find the above steps a little daunting, contact our customer support department letting us know the dev.your_domain_name.com and www.your_domain_name.com asking us to do the move for you for free.

Peter Abraham
Former CEO of Dynamic Net, Inc. Will be transitioning to a new career in the near future.
Peter Abraham

@

Peter Abraham

One Response to “Moving your WordPress Site from a development subdomain to a domain”

  1. Editorial update: removed SQL query which updated the GUID that contained references to the old URL from a very educational discussion with Jeremy Trask who pointed to http://codex.wordpress.org/Changing_The_Site_URL#Important_GUID_Note and kindly went over how some of the sites referenced on http://codex.wordpress.org/Moving_WordPress which mention changing the GUID is dated material no longer applicable to WordPress 3.x.x.

Leave a Comment