Redirect old blog traffic to new blog via htaccess

Recently my good friend honey needed help on redirecting his popular old blog http://honeytech.wordpress.com to his new blog http://www.honeytechblog.com .

He needed to save his old permalinks and redirect his wordpress.com traffic  onto the pages of Honeytechblog. The obvious way to use was a .htaccess file.

So, once he has redirected his honeytech.wordpress.com to a sub domain of honeytechblog.com , I provided him a htaccess file which redirect all traffic to a file which then forward the traffic to the main site honeytechblog.com

The htaccess file contents are :-


Options +FollowSymlinks
RewriteEngine on
RewriteRule ^$ http://www.honeytechblog.com [R=301,L]
RewriteRule ^([^/.]+)/([^/.]+)/([^/.]+)/([^/.]+)/?$ http://www.honeytechblog.com/$4 [R=301,L]
RewriteRule ^category/([^/.]+)/?$ http://www.honeytechblog.com/topics/$1 [R=301,L]
RewriteRule ^([^/.]+)/?$ http://www.honeytechblog.com/$1 [R=301,L]
RewriteRule ^([^/.]+)/([^/.]+)/?$ http://www.honeytechblog.com/$1/$2 [R=301,L]

Rewrite Rules are made for 301 redirects which is also known as SEO redirect , This effect is achieve by adding [R=201,L] attribute at the end of the Rewrite Rules. The regex identifier “^” identifies the start of the rewriterule , the regex identifier of “([^/.]+)” identifies a single word in the url and “?” identifier denotes the end of the rewrite rule.

The first rewrite rule redirects the main url of honeytech.wordpress.com to honeytechblog.com

RewriteRule ^$ http://www.honeytechblog.com [R=301,L]

The second rewrite rule redirect the blog posts to the newly made url !, However the old url of blog posts for honeytech.wordpress.com was in the form of http://honeytech.wordpress.com/2008/09/11/blogpost and the new post were more seo friendly with the url honeytechblog.com/blogpost

RewriteRule ^([^/.]+)/([^/.]+)/([^/.]+)/([^/.]+)/?$ http://www.honeytechblog.com/$4 [R=301,L]

Third rewrite rule redirect the category pages to the newly made topic urls

RewriteRule ^category/([^/.]+)/?$ http://www.honeytechblog.com/topics/$1 [R=301,L]

While the fourth and fifth rewrite rule redirect the pages of old blog to new blog

RewriteRule ^([^/.]+)/?$ http://www.honeytechblog.com/$1 [R=301,L]

RewriteRule ^([^/.]+)/([^/.]+)/?$ http://www.honeytechblog.com/$1/$2 [R=301,L]

2 thoughts on “Redirect old blog traffic to new blog via htaccess”

Leave a Reply