I am expecting you might have noticed the short URLs that are being used more and more frequently on Twitter, Facebook, Google and many more places. They look something like this http://goo.gl/maps/lPr5V and are a way of limiting the size of your website links. There are a handful that are widely used, such as bit.ly, t.co and goo.gl.
I needed to use URL shorteners to tweet my blog posts, and it occurred to me that it would awesome if I could use my own domain klint.co. It is short, descriptive and I own it (as much as you can own a non-physical conceptual digital asset). Furthermore, I want to drive traffic to my site anyway, so why give that traffic to a third party?
I did some initial googling and binging to come up with the tool/library YOURLS. It is a very basic implementation using a database, redirect and some smarts to generate a short unique URL that maps to a normal URL.
To set it all up follow these steps:
- Download and install YOURLS
- Follow the setup instructions
- If you are using WordPress install the YOURLS: WordPress to Twitterplugin.
- To configure it follow these steps (see what I did there?)
- If you have trouble authenticating your Twitter account with the plugin, try and disable all your Twitter related plugins. I had a conflict with one.
- You should be able to post to Twitter directly from your posts now.
In addition you can now log into the YOURLS admin panel, which lives at http://yourdomain/YOURLSdir/admin. From here you can create bookmarks to quickly create short URLs for whatever site you are on. This is handy for creating links on the fly which can be used on other sites, to then redirect traffic through your domain.
YOURLS also has the ability to act as an API, so other applications can interact with it and implicitly create short URLs for your domain. You set up a signature token in the YOURLS admin section and use that to authorize 3rd party applications to use YOURLS on your domain. If you are using the Chrome browser, the extension Template can make use of your custom URL shortener.
YOURLS is a great tool, and it is relatively easy to set up and integrate into your various sites, applications and tools. Have you used it? Any problems/caveats? Let me know in the comments below.