Blogger To WordPress Nginx 301 Redirection Rules

The process of moving a website from blogger or blogspot to a self-operated wordpress site is very simple.

All that one has to do is take a backup of the posts from blogger from settings > Other > import & backup.

Clicking the ‘Backup Content’ button downloads a xml file of all the posts made on blogger.

Thereafter, it is a simple matter of uploading these posts to the wordpress site using the Blogger importer tool at Dashboard > Tools > Import > Blogger.

However, the biggest problem is in ensuring that visitors who click the blogger/ blogspot link (e.g.

www.vps2.me/2012/06/nginx-wordpress-permalinks.html

get taken to the wordpress site equivalent link, namely,

http://www.vps2.me/nginx-wordpress-permalinks/

Apache 301 redirection

The surprising aspect is that even the Apache 301 redirection is very unstable.

I tried three tutorials by wpbeginner, labnol and bloggertowp (the makers of the easyengine auto installer LEMP script).

Unfortunately, none of the three methods worked well probably because they are not compatible with nginx.

The suggestion offered by bloggertowp is that we choose a permalinks format which mimicks the blogger permalinks including the .html at the end.

/%year%/%monthnum%/%postname%.html

This works sporadically. However, it looks untidy.

blogger to wordpress plugin 301 Redirection plugins

I also tried a number of plugins such as Blogger 301 Redirect, Blogger To WordPress, Redirection, SEO Redirection, Simple 301 Redirects etc. However, none of these work, especially with Nginx.

Nginx 301 redirection rules

Finally, I found a tutorial at serverfault which recommends that each url be redirected with the following code:

location = /content/unique-page-name {
  return 301 /new-name/unique-page-name;
}

So, I opened the Nginx conf file which is to be found at

/usr/local/nginx/conf/conf.d/mydomain.conf

in Centminmod

and

/etc/nginx/sites-available/mydomain.com

in easyengine

I restarted Nginx with the command

service nginx restart

for Centminmod and

nginx -t && service nginx reload

for easyengine

and there is a perfect redirection.

The only drawback that each url from blogger has to be separately ended in the Nginx configuration.

You May Also Like

Leave a Reply

Your email address will not be published. Required fields are marked *