WP: Redirect from blogger.com to another location

Jun 16th, 2008 | By dikiem | Category:WordPress Tips and Hack | no comments | 98 views |

This should be helpful for anyone who decided to host their own blog using WordPress another location. It took me awhile to search for this since the new blogger version template style changed a bit.

http://laffers.net/howtos/howto-redirect-blogger-to-wordpress

Thanks to laffers.net for putting this together. It was extremely useful!

Here are snip of what he presented there. All credit goes to him and those who supported him on this.

set up redirects

I’m assuming that at this point you have imported your posts to the new blog at Wordpress.com (if not, go to “Manage/Import”, select the obvious choice and do what you’re said).

Log into your Blogger account and click your way through the awkward navigation menu until you are at the “Template/Edit HTML” page. To redirect visitors from the main page, insert the following between the <head> and </head> tags:

<meta content='6;url=http://yournewblog.wordpress.com/' http-equiv='refresh'/>

Number 6 means that the redirection will take effect after 6 seconds. Replace the url with your own.

The tricky part comes now. We want to redirect users from individual post pages to the corresponding post pages on the new blog. For that, we need a piece of JavaScript spiced with Blogger proprietary tags. Insert the following right after “<b:section class='main' id='main' showaddelement='no'>” in the template:

<b:widget id='Redirector' locked='true' title='Blog Posts' type='Blog'>
<b:includable id='main'>
<b:if cond='data:blog.pageType == "item"'>
<b:loop values='data:posts' var='post'>
<script type='text/javascript'>
var new_page=&#39;yournewblog.wordpress.com/&#39;;
var permalink = &#39;<data:post.url/>&#39;;
var timestamp = &#39;<data:post.timestamp/>&#39;;
timestamp = timestamp.split(&#39;/&#39;);
timestamp = timestamp[2]+&#39;/&#39;+timestamp[0]+&#39;/&#39;+timestamp[1];
new_page = permalink.replace(/youroldblog\.blogspot\.com\/2007\/[0-9]{2}/,new_page+timestamp);
new_page = new_page.replace(/\.html$/,&#39;&#39;);
document.location.href = new_page;
</script>
</b:loop>
</b:if>
</b:includable>
</b:widget>

Don’t forget to enter your new blog’s URL at var new_page = .

Important note! For this script to work, all your posts should have been imported to Wordpress.com using their Manage/Import function. The creation dates of all posts must match, because they are part of the permalinks.

 

 



no comments | 98 views

Tags: , , ,



Leave Comment