How can I use a separate domain for URL shortening?

I have a hosted WordPress blog running on my own domain. I’ve recently considered trying to build a custom URL shortener (a la bit.ly) that I manage and control using a very short domain. I’m wondering how I can achieve this.

For example:

Read More

I want this: http://nerdgap.com/some-made-up-post-here/

To shorten to this: http://g4p.it/23 (where 23 is the Worpress post ID).

Is this possible? How can I go about it?

Thanks!

Related posts

Leave a Reply

2 comments

  1. You already get shortlinks of the form ?p=post_id, so http://nerdgap.com/?p=66 points to http://nerdgap.com/great-big-update-plus-giveaway/. You could exploit this by creating a simple redirection from http://g4p.it/{$post_id} to http://nerdgap.com/?p={$post_id}.

    You can then integrate this in your editor (the “Get Shortlink” button) and add a <link rel="shortlink"> in your header by hooking into the pre_get_shortlink filter, and returning http://g4p.it/{$post_id}.