fbpx
Skip to content

Moving from Blogspot to Hosted WordPress?

Simply use a 301 redirect with some devilishly ingenious code from TechCounter:

301 Permanent Redirect from Blogspot Beta to WordPress

11. May 2007, 10:51 By Ryan Ferone

Most Bloggers start out with free blog hosting with the most popular of the free services being Google’s blogger where you get a yoursite.blogspot.com address. Now you want to move from Blogger to your own domain. One of the best publishing software is provided by WordPress and the best part is it is free. Importing to WordPress from Blogger used to be a breeze using WordPress’s import posts feature. However when Google moved from Blogger to the new Blogger or Blogger Beta, it became impossible to use WordPress’s import utility.

However, you can now do so with the steps outlined here about Importing Blogger Beta Posts to WordPress

Many users were able to implement this method successfully. Now, we move to the next step. Lets deal with some questions I had so far …

  1. What happens to my old blogger blog? Should I just delete it after importing to WordPress?
  2. I heard Google penalizes duplicate content. I now have my posts at both my old blogger blog and my new WordPress blog hosted on my domain. What should I do?
  3. You mentioned using the 301 permanent redirect from blogger to WordPress. Can i do it?

Okay … lets deal with these questions first.

  1. No, you should not delete your Blogger blog. I am sure you worked hard at it. You might have many subscribers to that blog. The search engines have content indexed to that blog. What happens if you delete your blogger blog is simple … you end up LOSING ALL YOUR TRAFFIC, all your loyal subscribers and visitors simply because they don’t know your new address.
  • Yes, Google penalizes duplicate content. How do you deal with this.. well read on
  • When people move from their old website to a new one they use a 301 permanent redirect method without being penalized by the search engines. However, you cannot do this straight up with Blogger because you do not have access to your .htaccess file. So its not a simple plug and play unfortunately because of this.

How to redirect your old Blogger posts to your New WordPress blog posts using a permanent redirect

I wanted to thank Owen Barder for his excellent code to redirect your individual posts from blogger to WordPress. Also, thanks to Tom Sherman. I will try to stick to what these two guys have to tell.

Using the method outlined here, you will be able to

  1. Redirect your visitors from your old Blogger blog to your WordPress Blog on your domain
  • Redirect your old posts to new posts on your WordPress blog instead of redirecting them just to your home page of your WordPress blog
  • Do all this in such a way that Google does not penalize you. You also get to transfer your Google Page Rank too. How about that ….. !

Step # 1: Import from Blogger Beta to your WordPress domain

I am assuming that you backed up your blog and Imported to your WordPress domain from the new Blogger or Blogger Beta. If you didn’t do, check out my article on Import from Blogger Beta to WordPress

Step # 2: Modify your Blogger Template to include redirects

Log into your Blogger account. Go to Template and then Edit HTML. Paste the code shown below where you replace https://www.yoursite.com with the root URL of your WordPress Blog

a. Add the code below after <Blogger> in your template

<MainOrArchivePage>
<script language=”javascript”><!–
var blog_root=https://www.yoursite.com/;
document.location.href=blog_root;
//–></script>
</MainOrArchivePage>

<ItemPage>
<script language=”javascript”><!–
var process_page=”https://www.yoursite.com/bloggerposts.php”;
var newpage=process_page;
var oldlink=”<$BlogItemPermalinkUrl$>”;

newpage+=”?p=”+oldlink;
newpage=newpage.toLowerCase();
document.location.href=newpage;
//–></script>
</ItemPage>

b. Add the line shown here somewhere in between the <head> ..</head> tags of your blog

url=https://www.yoursite.com/” />

Notice the space between /” and the />

somewhere in between the <head></head> tags like this:

<head>
url=https://www.yoursite.com”>
</head>

Step # 3: Prepare your WordPress blog for Redirects

a. Open Notepad. Copy and paste the code given below. Save it as bloggerposts.php or anything else you want and put it in the root location of your WordPress blog. By root, I mean not in any wp-admin or any other folder, but in the root and the link should be something like https://www.yoursite.com/bloggerposts.php

php

require($_SERVER[’DOCUMENT_ROOT’].’/blog/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 = “https://www.yoursite.com/”;
}

?>

<html>
<head>
<title>Redirecting…</title>
<script language=”javascript”><!–
document.location.href=”php echo ($found_link); ?>”;
//–></script>

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=”https://www.yoursite.com/” mce_href=”https://www.yoursite.com/”>www.yoursite.com</a>.</p>
</body>
</html>

All you need to do in the above code is wherever you see https://www.yoursite.com , change it to the root location of your WordPress blog. What this code is doing is taking the URL from Step # 2 and redirect the user to the corresponding entry in your WordPress blog. In case it does not find the corresponding entry, it redirects to the homepage of your blog.

Related Blogs

1 thought on “Moving from Blogspot to Hosted WordPress?”

  1. Pingback: Another Way To Get Traffic

What do you think?

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