Redirecting from Blogger to WordPress

I’ve just moved my blog from Blogger (blogspot) to a self hosted WordPress installation. I’ve imported all posts with the Blogger importer available in WordPress.

The only problem left was that my “old” Blogger blog was still getting more traffic and the new one none. So I needed to:

  • redirect from the old one to the new one.
  • make sure Google doesn’t penalize me for non-unique content
  • make the redirect clever enough to redirect to the right post

There are plugins for this and also many web sites showing how to it, unfortunately none worked for me (some problems on the Blogger side…). So here’s how I finally got it working:

First you have to cope with the different permalink structures between Blogger and my WordPress install:
/YYYY/MM/POST_TITLE.html in Blogger
/POST_TITLE.html in WordPress

And also with the fact, that posts don’t always have the same name in Blogger and WordPress (e.g. if you had no title first when the post was created in Blogger and added one later, the post in Blogger would have the first words in the post content as path and the imported one would have the title as path).

The easiest way to cope with all this is to use the wordpress plugin SEO Blogger to WordPress using 301 Redirection. The UI for this plugin can be found in “Tools” but the code generated by this tool for Blogger wasn’t working (at least with the new Blogger interface). So I had to take care of the rest myself…

Then you need to configure a redirect with JavaScript:

Log into your Blogger account and click your way to the “Template/Edit HTML” page.

Search for a line with <script type=’text/javascript’> and add the following lines before the first line found:

<script type=’text/javascript’>
location.href=document.location.toString().replace(document.domain,’NEW_DOMAIN_NAME’);
</script>

(Replace NEW_DOMAIN_NAME by your new domain name)

This basically says to change the URL by replacing the current domain (e.g. benohead.blogspot.de) by the new domain name (e.g. benohead.com).

In case, the user has disabled JavaScript, we’ll implement a less clever redirect, which will just redirect to the home page of the new blog:

In Blogger, “Template/Edit HTML”: Add the following line just after <head>:

<meta content=’5;url=http://NEW_DOMAIN_NAME/’ http-equiv=’refresh’/>

(Replace NEW_DOMAIN_NAME by your new domain name)

Now, we do not want Google to penalize our new blog for duplicate content, so we’ll instruct Google to remove our old blog from their cache by adding the following line just after <head>:

<meta name=”ROBOTS” content=”NOINDEX, NOFOLLOW”/>

Since we’re basically only loading the old site/posts to redirect to the new blog, it’s a good idea to make it as fast as possible e.g. by removing all gadgets from the layout.

Update:

In order to have your new “old” posts (I mean the old post on the new domain) seen by search engines like Google as the same page as the post in Blogger, you need to add a canonical URL tag (since it’s not possible to setup a 301 redirect in Blogger).

Google, Bing and Yahoo! are all supporting the canonical URL tag since 2009 (and cross domain canonicals are now also accepted). Using this tag, you basically tell the search engine which is the preferred page in a set of pages with the same content i.e. “please only index the specified page”. This canonical URL tag needs to be added to all non-canonical versions of this page.

In order to add this tag in our Blogger blog, the following piece of code should be added between <head> and </head> in the Blogger template:

<b:if cond=’data:blog.pageType == &quot;item&quot;’>
<link rel=”canonical” expr:href=’&quot;http://NEW_DOMAIN_NAME/?blogger=&quot;+data:post.url’ />
<b:else/>
<link rel=”canonical” href=”http://NEW_DOMAIN_NAME/” />
</b:if>

This basically checks whether we’re displaying a single post. In this case we reference the appropriate post in WordPress. Otherwise we reference the main page.

Now self hosted

My blog is now self hosted and located at benohead.com. It’s hosted by the amazingweb GmbH and now based on WordPress.

The design is new. I’m not yet 100% satisfied with it but still working on it.

I’ve imported all the blog posts from bloodspot. Unfortunately a > was added at the beginning of all post titles and at the beginning of all posts. I’m not yet done removing them from all posts.

Of course, I still need to make sure that this new blog location get all the traffic which used to go to my Blogspot blog.

Adding sitemaps for your Blogger.com blog

Sitemaps

Before Sitemaps, all pages in a websites where made known to search engines crawlers by submitting them. With sitemaps, all pages in a website can be made know to the search engines (incl. Google, Bing and Yahoo). A sitemap is just an XML file that lists URLs for a website (with some additional data about each URL.

Here is a short description how to add sitemaps to your blog on blogger.com. Having a Sitemap will increase your chances of being indexed by the search engines by providing them with more information about your blog.

Google

In order to provide google with a sitemap for your site, you have to use the google webmaster tools: https://www.google.com/webmasters/tools/home.

In order to use them, you need to have a google account. Once you’ve logged in, click on the “Add a site…” button:

Then type in the URL of your blog (i.e. http://yourblogname.blogspot.com):

Once your site has been added, the Site verification page opens. Select “Add a Meta tag” as verification method. A meta tag will be generated, copy it and open blogger.com. Edit the design of your blog and select “Edit HTML”. Paste the copied metatag just after the tag.

the Dashboard will be displayed. Click on the “Submit a Sitemap” link:

It will take you to the Sitemaps tool. There click on the “Submit a Sitemap” button:

Then complete the displayed URL to point to a feed of your blog i.e. one of those:

  • atom.xml
  • rss.xml
  • feeds/posts/full
  • feeds/posts/default?alt=rss 
  • feeds/posts/default?max-results=500
  • feeds/posts/default?orderby=updated

After pressing “Submit Sitepad”, you’ll see the feed link in the Sitemap list:

Bing

Bing is the Microsoft search engine. Submitting a sitemap is really easy:
Just open the following URL in your browser:
http://www.bing.com/webmaster/ping.aspx?siteMap=http://yourblogname.blogspot.com/atom.xml
e.g.:
http://www.bing.com/webmaster/ping.aspx?siteMap=http://benohead.blogspot.com/atom.xml

Yahoo

 Submitting a sitemap to Yahoo is also extremely easy:

Just open the following URL in your browser:

http://search.yahooapis.com/SiteExplorerService/V1/ping?sitemap=http://yourblogname.blogspot.com/atom.xml

e.g.:

http://search.yahooapis.com/SiteExplorerService/V1/ping?sitemap=http://benohead.blogspot.com/atom.xml