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!

Subscribe to RSS

By: Leland on Mar. 8

Bookmark and Share

4 Comments »

Comment by Jasko
2008-03-08 18:01:47

great advices thanks, you are bookmarked

 
Comment by Joseph de Lena
2008-05-02 23:00:33

topic bookmarked.tks

 
Comment by Gian Paolo
2008-05-18 05:58:34

Thanks for the valuable information.

 
Comment by Techronnati
2008-06-13 05:12:36

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

 
Name (required)
E-mail (required - never shown publicly)
URI
Subscribe to comments via email
Your Comment (smaller size | larger size)
You may use <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong> in your comment.

Trackback responses to this post

Recent Comments

  • Nisheeth: Hi, How to make changes to the main page, like changing the text of About or removing it
  • Marshal: Hi Leland, I am a big user of these theme, but I run my blog in Spanish, so every time the theme is updated...
  • Dan Gheorghe Somnea: Hello, I am an wordpress newbie. I appreciae this 3 columns wordpress theme as an oportune for...
  • Anto: Meh this looks interesting. I hope they put better themes up there tho. Or design some with they’re...
  • #FN$#: Really? Oh,thank you!! I’m glad you like it!…

About The Author

Welcome to Theme Lab. My name is Leland, and I run the place. I write all the tutorials and code all the themes you see here on the site.

For more information about me, feel free to read the about page. If you want to drop me a message, feel free to contact me.

Interested in advertising on Theme Lab? We have advertising available at very reasonable rates. Head on over to the advertising page for further details.

Please read our Privacy Policy and Terms of Service in regards to theme usage.

© 2008 - Theme Lab - Powered by WordPress