Redirecting a blogspot blog to Wordpress
Posted on February 24, 2006
UPDATE: An alternative method that moves more of the smarts to wordpress is available here from Tom Sherman of underscorebleach.net.
In case you haven’t noticed this blog used to be at cebidae.blogspot.com, but I decided to move it to my own server so I had more control over what I could do, now, and in the future.
Importing the old blog’s entries was a trivial task as it is build into the wordpress software these days. The main difficulty I was having is how to get people arriving at the old site to come over here.
The main advice appears to be that you should leave your blogspot site there, but redesign so it is clear that you have moved to a new site. I wasn’t really happy about this, because people are lazy, so I wanted to automatically redirect them to the new site.
There are basically three types of pages you want to redirect from your blogspot address to wherever it is you are going:
- The main page (/)
- Archive pages (/2004_12_01_cebidae_archive.html)
- Item pages
(/2004/10/gadget-price-searching-use-staticice.html)
I wanted to redirect these three types of pages to the same pages on this site. I managed to get the main page and the item pages working but not the archive pages. Seeing as how most external links either point to the main page or a particular item page, the archive pages are unlikely to be landed on too often, so I chose to just redirect them to the new main page here. If anyone can help me redirect the archive pages correctly, that’d be great.
Redirecting the main page (and the archive page)
To set up a redirect to “http://www.cebidae.com” you need to use the following tags between the <head> and </head> in your blogger template
<MainOrArchivePage>
<META http-equiv="refresh"
content="3;URL=http://www.cebidae.com">
</MainOrArchivePage>
MainOrArchivePage makes sure this only happens on the main or archive pages and the meta tag tells whoever lands here to redirect to http://www.cebidae.com in 3 seconds.
Redirecting the item pages
Obviously if you are going to redirect your visitors to a new site, you need to know the url that they should be going to. This was easy with the main pages, but a bit harder with the item pages. I decided that the best option was to use the built in search on this site to search for entries matching the title of the old entry. To do this you need to insert the following tags after </MainOrArchivePage> but still within the <head> and </head> tags:
<ItemPage>
<Blogger>
<META http-equiv="refresh"
content="3;URL=http://www.cebidae.com/index.php?s=<$BlogItemTitle$>">
</Blogger>
</ItemPage>
ItemPage makes sure this only happens on item pages, and this time the redirection is to a search on the new site for the title of the item on the old. the Blogger tags are required or blogger won’t evaluate <$BlogItemTitle$>.
I also put a small body section in my template that has a link to the new site in case their browser doesn’t support redirection:
<body>
<br/><br/>
<MainOrArchivePage>
<p>This page has moved. You can find the new page
<a href="http://www.cebidae.com" >here</a>.
You should be redirected in 3 seconds.</p>
</MainOrArchivePage>
<Blogger>
<ItemPage>
<p>This page has moved. You can find the new page
<a href="http://www.cebidae.com/index.php?s=<$BlogItemTitle$>" >here</a>.
You should be redirected in 3 seconds.</p>
</ItemPage>
</Blogger>
</body>
» Filed Under blogger, computer, howto, wordpress
Comments
2 Responses to “Redirecting a blogspot blog to Wordpress”
Leave a Reply
Thanks for this nice tip
رضا
nice tips….very useful to everyone