Take the 2-minute tour ×
WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. It's 100% free, no registration required.

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!

share|improve this question
add comment

2 Answers 2

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).

share|improve this answer
add comment

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}.

share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.