Redirect Blogger To WordPress Posts Links Without Losing Traffic & SEO

After you export your posts from Blogger to WordPress, you will discover that some links of your posts on WordPress will be longer than their original links on Blogger.

Look at the WordPress post link below:

http://www.ogbongeblog.com/2010/10/welcome-to-wordpress-this-is-your-first-post-edit-or-delete-it-then-start-blogging.html

And the following blogger.com post link for the same post:

http://www.ogbongeblog.com/2010/10/welcome-to-wordpress-this-is-your-first.html

If you fail to fix this, you will lose lots of traffic and will somehow hurt your SEO too.

So, after setting up the /%year%/%monthnum%/%postname%.html custom permalink structure, you must ensure your permalinks on WordPress and Blogger are identical if you want to retain all your traffic & SEO! This is very important.

So, How?

Just copy-paste the codes below into a file with name like fix.php and save/upload it to the WordPress folder.

    <?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 "DONE";
?>

Then just open its URL from the browser. URL will be like: http://example.com/fix.php (replace example.com with your domain name).

On executing this script, the only output you must see is “DONE”.

At this point, check the post links on your WordPress blog. Their path part must now be identical to Blogger.com post links.

1 Like

will i save it offline or online sir??

I don’t really understand your question. I believe your site is online and you are expected to upload it to your site file manager…

thank you very much for the reply @jidetheblogger ,my site is online buti uploaded it to my file manager on hub8 ,followed your instruction but page didnt come up

Oh, I think I understand you better now.

You can create a “fix.php” file offline and upload it to your file manager. After you upload it, then then just open its URL from the browser. URL will be like:http://example.com/fix.php (replace example.com with your domain name).

After hitting ENTER on your keyboard, the only output you must see is “DONE”, not the content of the file.

1 Like

Great tips.

1 Like

@jidetheblogger It worked perfectly… Thank you for the great tip

1 Like