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:
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!
Try Yourls. I hadn’t used it myself but feedback I seen is very positive and it is project by very known developers (Lester Chan and Ozh).
You already get shortlinks of the form
?p=post_id
, sohttp://nerdgap.com/?p=66
points tohttp://nerdgap.com/great-big-update-plus-giveaway/
. You could exploit this by creating a simple redirection fromhttp://g4p.it/{$post_id}
tohttp://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 thepre_get_shortlink
filter, and returninghttp://g4p.it/{$post_id}
.