WordPress change domain names

Well I thought it was time to change domain names hosting my blog WordPress site.

Hello from davidhill.co and goodbye virtual-blog.com

wordpress change domain names

So why did I make this decision?  I certainly haven’t taken it lightly.  Moving Domain Names is challenging and requires a lot of thought and pre-planning.  However, I wanted to have a blog site that was more relevant to me personally, rather than just purely virtualisation.  My old domain name just didn’t fully reflect the content anymore.  I was able to purchase davidhill.co when they released the .co domains with the intention of switching.  Now I have finally bitten the bullet and gone ahead with the migration.

WordPress Change Domain Names

So what steps did I take?

Well first off, I bought the domain name (yeah duh!!)
Secondly I spent a number of hours researching what I had to do to manage my SEO. This is a really good link that can help you understand what is needed: https://support.google.com/webmasters/answer/83106?hl=en
Once I investigated and realised I had to setup 301 redirects from my old site, to the new site, I decided to use the plugin Simple 301 Redirects.

Export permalinks to CSV file

Now one of the challenges I had was to redirect every URL on my site… Hmmm, please tell me I dont have to do this manually… A quick google brought me to this site, which has some nice PHP code that allows you to export every permalink URL on your site.  Pretty cool!

I modified the code to just export the URLs and nothing more.  I have included the code I used on my site.  Simply paste into a text file, and save as export.php in the root of your website.


<!--?php include "wp-load.php"; $posts = new WP_Query('post_type=any&#038;posts_per_page=-1&#038;post_status=publish'); $posts = $posts--->posts;
/*
global $wpdb;
$posts = $wpdb-&gt;get_results("
SELECT ID,post_type,post_title
FROM {$wpdb-&gt;posts}
WHERE post_status&lt;&gt;'auto-draft' AND post_type NOT IN ('revision','nav_menu_item')
");
*/
header('Content-type:text/plain');
foreach($posts as $post) {
switch ($post-&gt;post_type) {
case 'revision':
case 'nav_menu_item':
break;
case 'page':
$permalink = get_page_link($post-&gt;ID);
break;
case 'post':
$permalink = get_permalink($post-&gt;ID);
break;
case 'attachment':
$permalink = get_attachment_link($post-&gt;ID);
break;
default:
$permalink = get_post_permalink($post-&gt;ID);
break;
}
echo "t{$permalink}";
}

The output looks like this:wordpress change domain names

Simply save as a text file and import into excel.  Then install the 301 Redirect Bulk Uploader and create a CSV file and do a bulk upload.

Once you have the 301 redirects in place, its time to hit google webmaster tools and complete the change of address. You need to have the old site up and running to have the redirects in place for at least 180 days.

One final step is to start contacting all the web administrators who link to my site, and ask them to change the URL.

Thats it so far, if anything else occurs I will update this page accordingly.

, , ,

No comments yet.

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.

Copyright David Hill

Powered by WordPress. Designed by Woo Themes

%d bloggers like this: