Sometimes you have to work on a subdomain on a WordPress site where you set your robots.txt to not to crawl it. Or you do work on your local machine.
But when it’s finished…you’ll have to move it to the final domain.
But how ?
Here is a basic synopsis of what you need to do.
- Register the new domain with your favorite registrar
- Point the Name Servers at the domain name registrar to the new host
- Set up the new domain at the new host
- Copy all files and database (see below) from old site to new site
- Edit wp-config.php to have the right database settings and add code for new domain (see below)
- Install the Search and Replace plugin to search for old URLs and replace them with the new URL
- Go through new site checking links, etc., change logo and branding, create new email subscription, change any product URLs, etc.
- Add 301 redirection from old blog to new blog (if necessary)
- Change feed URL in Feedburner, set up new Google Webmaster Tools and Google Analytics accounts to monitor indexing and traffic of new site
The 3 first steps are easy and quickly done. The fourth one can also be easily done using a good FTP program. The fifth is easy too.
For the database, I suggest to use phpMyAdmin and it’s export tool if you need to copy the database onto another one.
Onece it is done you must change strings pointing to the old domain with the string of the new domain. You can do that two ways.
The first one is by using a plugin. This one will do : http://wordpress.org/extend/plugins/search-and-replace/
The other solution is to do it manually. In recent WordPress installations you have two tables that hold these information:
- wp_posts : the table holding the posts
- wp_options : the table holding the options
Here goes two sql statements you can run to do the trick (please, backup first).
For the wp_options use this one
update wp_options set option_value = replace(option_value,'http://oldDomain','http://newDomain')
and for the wp_posts, this one :
update wp_posts set guid = replace(guid,'http://oldDomain','http://newDomain')
you might also need to check for the post_content
update wp_posts set post_content = replace(post_content,'http://oldDomain','http://newDomain')
That’s it, it should now work and you should see the content of your blog when pointing to your new domain.