Problem Scenario
I migrated my blog from makuchaku.info to makuchaku.in – and wanted everyone who was linking to my “.info” domain, automagically gets linked to my “.in” domain. Ofcourse, I cannot change all the possible places from where my .info blog is linked.
Challenges
- I want “.in/” to be served when “.info/” is cliked
- I want “.in/blog/this-is-a-post” to be served when “.info/blog/this-is-a-post” is clicked.
Ofcourse, Challenge 1 is very east and straight forward. Just put up a redirection at .info domain and you’r done. Challenge 2 is interesting.
Solution
Goto your theme editor (old wordpress blog) and edit the template for which you want to setup redirection. For me, it was all posts and all pages. Next, insert this javascript code at the top of template code…
Thats it. Now whenever you’ll hit http://makuchaku.info/blog/why-makuchaku – you will be redirected to http://makuchaku.in/blog/why-makuchaku – sweet!
Assumptions
This solution assumes that your new blog is a mirror replica of your old blog.
Please Digg this post if it helped. Thanks.