ThemeLab's Blog

Stay up to date with our newest WordPress themes, WordPress plugins, WordPress tutorials, and other announcements.

Is it time to move to a self-hosted WordPress?

Last Updated on by

Today I noticed a lot of Blogspot blogs serving up 502 errors, making almost all the Blogspot-hosted blogs I frequent temporarily innaccessible. For a lot of Blogspot users, the image below will look very familiar:

Blogspot 502 Server Error

Don’t get me wrong, Blogspot (a service of Google) is great for some people, and this may just be a hiccup, but do you really trust your blog in the hands of a free service? If you want to have peace of mind in knowing your blog is safe from these unexpected Blogspot outages, and want to make the switch to a self-hosted WordPress on your own domain name, read on.

Step 1: Buy a domain name
If you don’t have your own domain name already, get one. The advantages of hosting on your own domain over a Blogspot URL in terms of SEO (search engine optimization) are undeniable. There are a number of domain registrars you can use to buy relatively cheap domains (usually less than $10 per year). Some recommendations:

  • GoDaddy – This is a very popular domain registrar with an easy to use interface. The phone and e-mail support is also top notch. Try using the coupon code “hash3″ to get a discount on your domain registration. The price will be a little more than $7.
  • NameCheap – They are known for their reliability, cheap prices, and easy to use interface. Try using the coupon code “SPRINGDAYS” to bring your price down from $9.29 to $8.41.
  • DynaDot – I’ve never personally used them myself but heard nothing but good things about them and their support.

You really can’t go wrong with any of these registrars. The price may vary slightly, just choose whichever you feel most comfortable with.

Step 2: Get hosting
A hosting company I’d personally recommend is HostGator. Their hosting plans offer plenty of web space and bandwidth, and in my experience – the servers are very fast. Support is very quick to respond as well, which is surprising considering the incredible size of their company. They also have a nifty little tool called Fantastico, which will automate your WordPress installation (along with countless other open source scripts). Of course there are plenty of other suitable hosts out there, just choose whichever you feel most comfortable with.

Step 3: Point your new domain name to your new hosting account
Once you buy your domain and get hosting, you need a way to “point” your domain to this hosting account. This is accomplished through setting something called nameservers (provided by your host) within your domain registrar account. It’s relatively straightforward thing to do, and involves filling in a couple input boxes with 2 (or more) nameservers and submitting the changes. You could see your domain pointing to a blank Index Of / page very soon.

Step 4: Install WordPress
If you chose a host which uses Fantastico or some other automated script installation tool, simply follow the prompts and you should have a fresh installation of WordPress set up in no time. If not, please consult our how to install WordPress post to do it manually.

Step 5: Import your Blogspot blog
Okay, you should have an empty WordPress blog now. Chances are, you’ve invested a lot of time in energy into your blog and don’t want to start fresh. You should probably import your entire Blogspot blog into your new WordPress installation. Fortunately for you, WordPress has a built-in import feature that can login to your Blogger account, grab all the posts, and add them to WordPress. In your WordPress administration panel, select the Manage tab, and then select the Import tab.

WordPress Import

As you can see WordPress can import from a lot of other blog hosting services as well, including their own WordPress.com. While importing Blogger posts, you’ll need to “Grant Access” to WordPress to login to your Blogger account and grab all your posts. This process will take a few minutes, depending on the size of your Blogspot blog.

Step 6: Finishing Touches
If your blog is already well-established, you’ll probably want some way to redirect your visitors to your new URL. First thing you need to do is edit the HTML in your Blogspot template.

Add the following code below in your template:
<MainOrArchivePage>
<script language=”javascript”><!–
var blog_root=http://www.yoursite.com/;
document.location.href=blog_root;
//–></script>
</MainOrArchivePage>
<ItemPage>
<script language=”javascript”><!–
var process_page=”http://www.yoursite.com/blogger-redirect.php”;
var newpage=process_page;
var oldlink=”<$BlogItemPermalinkUrl$>”;
newpage+=”?p=”+oldlink;
newpage=newpage.toLowerCase();
document.location.href=newpage;
//–></script>
</ItemPage>

In between the head tags in you Blogger template, add this:

<head>
<meta http-equiv=”refresh” content=”0;url=http://www.yoursite.com/” />
</head>

Of course you’ll have to replace http://www.yoursite.com/ with your new URL.

Now, to prepare your new WordPress blog to accept these redirects and forward them to the corresponding posts, you’ll need to create a new file in your WordPress root directory to do this. We’ll call it blogger-redirect.php. You can rename this file if you want, as long as it corresponds with the URL you defined in the Blogger template. Add the following code to this file and save:

<?php
require($_SERVER[’DOCUMENT_ROOT’].’/wp-blog-header.php’);
$search_link = $_GET[’p'];
$vars = explode(’/', $search_link);
$num = count($vars) - 1;
$filename = $vars[$num];
$slug = str_replace(”.html”, “”, $filename);
$SQL = “SELECT posts.* FROM $wpdb->posts AS posts WHERE posts.post_name = ‘$slug’ LIMIT 1?;
$posts = $wpdb->get_results(”$SQL”);
if ($posts) {
foreach ($posts as $post) {
$found_link = get_permalink($post->ID);
}
}
else
{
$found_link = “http://www.yoursite.com/”;
}
?>
<html>
<head>
<title>Redirecting…</title>
<script language=”javascript”><!–
document.location.href=”<?php echo ($found_link); ?>”;
//–></script>
<meta http-equiv=”refresh” content=”2;url=<?php echo ($found_link); ?>”>
</head>
<body>
<h1>Redirecting…</h1>
<p>You can also proceed immediately to <a href=”<?php echo ($found_link); ?>”><?php echo ($found_link); ?></a>.</p>
<p>The main blog URL is <a href=”http://www.yoursite.com/” mce_href=”http://www.yoursite.com/”>www.yoursite.com</a>.</p>
</body>
</html>

Remember to replace all the yoursite.com’s with your new domain name. All this code does is try to determine which Blogger post the traffic is coming from, and forwards it to the corresponding page in your new WordPress blog.

And that’s about it. This method of importing not work for some people for whatever reason, but hopefully this article gives you new insight on blogging with your own domain and hosting. Feel free to comment and share if you liked the article!

  • http://jasmin-morehard.blogspot.com/ Jasko

    great advices thanks, you are bookmarked

  • http://planetwallpaper.blogspot.com/ Joseph de Lena

    topic bookmarked.tks

  • http://gianpaolosamson.blogspot.com Gian Paolo

    Thanks for the valuable information.

  • http://techronnati.wordpress.com Techronnati

    WOW!! great site… one of the best sites i’ve been to. =)

  • http://mylotventure.blogspot.com How do to do freelancer diary

    Yup Yup.. thats what i looking for and want to do.. blogspot just get slower and slower.

  • http://eclecticschooling.blogspot.com Sweet Serendipity

    Oh, I so need to take the plunge. Bookmarked!

  • http://www.gasmileageace.com Gas Mileage Ace

    I will be trying this tonight! Can I combine a wordpress blog and a blogspot blog on my own domain?

  • Leland

    @Gas Mileage Ace: I’m not sure why you’d want to do that, and I can’t think of a way how. I suppose it could be possible if they were on different subdomains?

  • http://freshmommyblog.com Tabitha Blue

    Can I work on the WordPress blog and get things set up before I point my domain at it? Right now my current domain is forwarded to my blogger blog and I don’t want people to go to it on WordPress yet until I have it all set up…

    • Leland

      Tabitha, it’s possible to set up a staging site on another server or even locally. When it’s ready you can migrate it to your new host.

      • http://freshmommyblog.com Tabitha Blue

        Thanks! I just set it up locally…. we’ll see how I do with switching it over once it’s ready. :)