Why you don’t need a URL shortening service if you use WordPress

I was in the mood for a long post title. Sue me.

My thoughts on URL shortening services are pretty public but that doesn’t mean that I don’t have a need for them. I prefer Bit.ly over any other URL shortening services that I’ve used to-date.

With Tr.im dying I thought that there was always the possibility of Bit.ly going down the same path. It was time to create my own URL shortening service for short URLs pointing to my site using my own domain. I browsed around, found two WordPress plugins that could have been candidates – but ultimately decided to use nothing but vanilla WordPress.

The Short URL plugin makes it very easy to take any URL and make it nice a short, track clicks, etc. I have this installed in case I want to shorten URLs that are not ultimately here on my site. (Though I still plan on using Bit.ly for these links). Short Post URLs is a plugin that seemingly does exactly what I want – which is make a shorter URL automatically for every post here on my site. However, the problem is that by default the plugin does not redirect from the short URL to the long one. This means that my posts would have two URLs. This isn’t what I was looking for and I didn’t want to hack someone else’s plugin.

That is when I saw it, right under my nose. The default link for any post on any WordPress blog is domain.com?p=postID. For instance, the short URL for this post is http://cdevroe.com/?p=2682. If you link to that URL WordPress will automatically forward that request to the full URL. Simple. Beautiful. Exactly what I need.

Occam’s Razor in full effect.

Update: Dean Robinson, maker of the fine mobile Twitter client Hahlo, suggests in the comments adding a simple line to your .htaccess file (if you’re so inclined) to pretty up your URLs. I’ve decided to add this for mine so that now both the original, default WordPress URL of ?p=postID works as well as /p/postID works now. Thanks Dean.

Last updated:

Powered by Hubbub Pro+