This is really the best working tutorial about Blogger to Wordpress migration without losing traffic. How do I switch from Blogger to Wordpress without losing my subscribers and SEO keywords?
functions.php Code
function wpb_update_slug() {
global $wpdb;
$result = $wpdb->get_results("SELECT post_id, meta_value FROM $wpdb->postmeta WHERE meta_key = 'blogger_permalink' ");
$wpdb->print_error();
foreach ($result as $row){
$slug = explode("/",$row->meta_value);
$slug = explode(".",$slug[3]);
$wpdb->query("UPDATE $wpdb->posts SET post_name ='$slug[0]' WHERE ID = '$row->post_id' ");
}
echo "All Done..";
}
ANOTHER USEFUL METHOD Steps to Migrate From Blogger to WordPress:
Method 1:
Step 1 : Import your Blogger Blog to WordPress
To import your Blog to WordPress, go to Tools-> Import and then click on Blogger.
A pop-up will appear, asking you to install blogger importer plugin. Click on the Install button. Once it is installed, activate the plugin and Run Importer link to continue.
You will be redirected to another screen where you need to authorize WordPress to import your Blog. Click on Authorize button on this page, which will take you to your Google Accounts page. Then you will be notified that WordPress is requesting permission to manage your Blogger account. Click on Allow access button.
Now you will see the list of your Blogger blogs. Just click on the import button next to the blog you want to import.
Once WordPress imports all your posts from blogger, you need to assign an author to the imported posts.
You have successfully imported your Blogger blog to WordPress..! But you still need to make sure that you don’t loose any search rankings and visitors to your old blog.
Step 2 : Setting up Permalinks
From your WordPress Dashboard, go to Settings > Permalinks and then select Custom Structure option. Paste the following value next to it and save changes.
- /%year%/%monthnum%/%postname%.html
Step 3 : Setting up Redirection
This is the most important step in moving any blog so that users are redirected to your new blog. You would want users to land on exactly the same page on the new site and also want the search engines to notice that your old site is moved to new location.
You need to setup redirection on two levels. First, redirect blogger visitors to your new WordPress blog. Secondly, once users reach your WordPress site you will redirect them to exact post they were accessing on your Blogger blog.
Setting up redirection on Blogger blog:
Log on to your Blogger account and go to settings. Click on Template.
On the template page, scroll down to bottom and click on “Revert to Classic Template” link.
After that, you will see “Edit Template Html” text area. You need to replace the entire code with the following code.
- <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"><html xmlns="XHTML namespace" xml:lang="en" lang="en" dir="<$BlogLanguageDirection$>"><head><title><$BlogPageTitle$></title><script type="text/javascript"> <MainOrArchivePage>window.location.href='All Tech Buzz - Best Tips and Tricks on Internet'</MainOrArchivePage> <Blogger><ItemPage> window.location.href='What way Blogger is better than Wordpress?<$BlogItemPermalinkURL$>' </ItemPage></Blogger></script><MainPage><link rel="canonical" href="All Tech Buzz - Best Tips and Tricks on Internet" /></MainPage><Blogger><ItemPage> <link rel="canonical" href="All Tech Buzz - Best Tips and Tricks on Internet<$BlogItemPermalinkURL$>" /></ItemPage></Blogger></head><body><div style="border:#ccc 1px solid; background:#eee; padding:20px; margin:80px;"><p>This page has moved to a new address.</p><h1><MainOrArchivePage><a href="All Tech Buzz - Best Tips and Tricks on Internet"><$BlogTitle$></a></MainOrArchivePage><Blogger><ItemPage> <a href="All Tech Buzz - Best Tips and Tricks on Internet<$BlogItemPermalinkURL$>"><$BlogItemTitle$></a></ItemPage></Blogger></h1></div> </body></html>
Make sure that you replace https://www.domain.net with your domain name.
Save your template, and you have successfully implemented redirection on your Blogger blog.
However, you still need to setup your redirection on your WordPress site so that users are redirected to the proper posts. To do that, you need to create a new file using a plain text editor like Notepad. Give this file a name like fixlinks.php
and copy this code in the file.
- <?php require_once('wp-load.php');$res = $wpdb->get_results("SELECT post_id, meta_value FROM $wpdb->postmeta WHERE meta_key = 'blogger_permalink'");$wpdb->print_error();foreach ($res as $row){ $slug = explode("/",$row->meta_value);$slug = explode(".",$slug[3]); $wpdb->query("UPDATE $wpdb->posts SET post_name ='" . $slug[0] . "' WHERE ID = $row->post_id"); $wpdb->print_error();}echo "Permalinks are Fixed! Welcome to WordPress, Happy Blogging";?>
Upload the file to public_html of your wordpress installation.
Now you need to run this php code on your site from the following link to fix the permalinks issues. You should get a message as done.
Step 4 : Redirect Feeds
On your old blogger site, your feed subscribers will not be able to notice the switch from Blogger to WordPress. They might bookmark your Blogspot site in their browser and so, it would be best to redirect your blogger feed to your new WordPress site’s feed as well.
For that process to go on, you need to Login into your Blogger account. Go to the Settings & click Other. You’ll be seeing Site Feed section, Under that Click on Add link next to Post Feed Redirect URL.
Here you can type the web address of your new WordPress RSS feed here and the existing RSS subscriber will automatically move to your new feed.
Other method if in case the above method is not working:
- Just export the XML file from Blogger.
- Then import the same using importer plugin on WordPress.
- Then repeat the steps listed above.
Very useful information. This year, I want to learn how to make my blog more attractive and post like yours are helpful.
ReplyDelete