Tuesday night I set about purchasing a new domain name for the blog, firstly it was tough simply finding one that could serve the purpose. .com domains that actually mean anything are starting to be in very short supply and even though many interesting companies have come up with words that at the time didn’t mean anything, a blog is suited to words that make sense from day 1.
After choosing my domain and delegating the name servers (surprisingly fast nowadays) I was able to start the difficult task of moving an establishing blog to a new domain while the previous one was still running.
To move a WordPress blog, you must have the contents of the site’s folder (ie public_html) and saved sql file, once you’ve done that, upload the wordpress files to the new site, upload the sql files to the new database and change the details in wp-config.php file, once you’ve done that you must change the domain listed in the sql table wp_options from your old one to your new one. Then run this sql command:
UPDATE wp_posts SET guid = REPLACE (guid, 'http://exampleoldsiteurl.com', 'http://examplenewsiteurl.com');
This is assuming you have the default names for wp_posts and guid, change the first url to your old domain, change the second url to your new domain.
This was fairly straight forward, however it seems that every link in every post and page’s links are hard coded with the url of the old domain, so I went through using a similar command to the previous one to change every instance in every post to the new address
There were also some references to the absolute address for the site, which changed completely, they didn’t seem to be causing problems, but I changed them just to be sure.
Once I had done that the site was active, I just needed to change a few minor things and it was almost ready.
Firstly I redirected beejay.perthmatrix.com/* to www.techgremlin.com/*, this is to ensure that anywhere that I haven’t updated my address and anywhere that has a link to beejay.perthmatrix.com is still able to access the area requested as the server automatically redirects, for example if you go to http://beejay.perthmatrix.com/2008/09/17/the-digital-downloads-delusion/ you’ll find that you have just arrived at https://www.techgremlin.com/2008/09/17/the-digital-downloads-delusion/ without having to update the link, it also works for image links.
If you are running cpanel this is quite easy, on the redirection page add your old address to the first field and add your new domain to the field underneath titled ‘redirect to’ and check the box labelled wild card redirect, then click add.
This also helps me as my site works well for it’s SEO abilities and considering I don’t know what I’m doing in that area half the time. Allowing the old domain to stay open, while redirecting people who have found the old site through a search engine allows the new domain time to be indexed by the same search engines.
WordPress.com accounts are tricky, it seems that if you create a username for use with the WordPress Stats Plugin for a site, it is linked to it forever, further more you can’t add any more, so I instead created a new account for this domain.