How do I set up a custom URL shortener for my posts?

I have several different sites running off WordPress, and the URLs tend to get fairly long and cumbersome (particularly when I try to publish them via Twitter). I recently purchased a very short domain name, and I’d like to use it as the root of a personal URL shortening service.

So …

  • http://www.eamann.com/portfolio would become http://eam.me/portfolio
  • http://www.mindsharestrategy.com/wp-xmlrpc-movabletype/ would become http://eam.me/df3DF
  • http://www.prosepainting.com/coffee-shop-part-1/ would become http://eam.me/csp1
  • And custom things like http://wordpress.stackexchange.com/questions/3076/feature-survey-what-would-you-want-in-a-resume-theme would become http://eam.me/wpa3076

Basically, I want to set up and manage my own TinyURL-like server … but with some specific requirements:

  1. It should integrate fully with WordPress so I can dynamically create new short URLs whenever I create a page or a post (every piece of content I create on each site should have its own short URL).
  2. I can specify if I want the URL to be random (like /df3Df) or I can choose a unique string instead (like /wpa3076) at the time of URL creation
  3. I should be able to view/edit/manage the URLs I have in the database from within WordPress

At the moment, I’m leaning towards a standalone system like YOURLS that lives in its own database. The problem I’m facing (and I’ll confess now that I haven’t attempted it yet) is integrating the system fully with WordPress. I want each post to automatically suggest a short URL before I hit “publish” and then automatically create the URL when I finally do “publish” the post. I’d also like to administer all of my links from within each of the sites using the service.

Is this even possible? Is there already a solution around to do this? If not, where do I start?

(Cross-posted to StackOverflow)

2 Answers
2

I’ve set up YOURLS for and have been extremely pleased. With the wordpress plugin, it will automatically create a short url for you if there isn’t one. And with the Admin of YOURLS you can create your own custom short url’s to anything you want, granted it isn’t in WP Admin.

I don’t believe you can set your own custom url at the post creation either, you would have to go into the YOURLS Admin to update it.

The other one I looked into was http://wordpress.org/extend/plugins/short-url-plugin/ but I wanted the more powerful backend that YOURLS provided; plus the post to twitter was a bonus.

Leave a Comment