I was having trouble finding the right URL shortening service. My requests for shortening were not too picky. I wanted two simple features:
- Good statistics that are visible only to administrators
- Edit the long URLs after generating shortened links
…but not one service has both features:
- http://sn.im has editable URLs, a bookmarklet, but no stats. Oh, and they kept on deleting my links.
- http://bit.ly has great stats, name recognition, but the links aren’t editable and the stats are public.
- http://goo.gl is the fastest service (so they claim), they have good stats (maybe the best, since they include OS & browser information), but they don’t have editable links or private stats.
Other smaller offerings may have had both features, but they also seem unreliable. I wanted control of my links.
Self-hosted Link Shortening with YOURLS
Enter YOURLS; a self-hosted link shortening service that is created by two amazing WordPress plugin developers: Lester Chan and Ozh Richard.
They created YOURLS in a WordPress-like fashion, with developer goodies such as hooks (actions and filters) and plugin capabilities, so you can easily modify how the application works.
You can set up YOURLS however you want, including making it a public service, public stats, etc. or making it private. I set up a YOURLS installation on my new katz.si domain, which was a snap, except for one minor snag caused by HostGator’s security rules.
You do need to be able to set up a database and edit one configuration file, but other than that, super-simple.
They also have a WordPress plugin that links your WP installation with YOURLS, aut0-generates links, and works like a charm.
Don’t Track Logged-In Users in YOURLS
Once it was installed, I became a link-generating fool. I was clicking the links to see how well the redirections work (they work well!), but the test clicks were logged — this pissed me off with bit.ly and other URL shorteners: don’t offer a way to not track logged in users! I have long thought that this is ridiculous.
To make it so that YOURLS doesn’t track logged-in users, it’s a simple two-line update. Find the following lines in `yourls-go.php`:
// Update click count in main table $update_clicks = yourls_update_clicks( $keyword ); // Update detailed log for stats $log_redirect = yourls_log_redirect( $keyword );
and update them to be:
if(yourls_is_valid_user() !== true) { // Begin: Don't log logged-in users // Update click count in main table $update_clicks = yourls_update_clicks( $keyword ); // Update detailed log for stats $log_redirect = yourls_log_redirect( $keyword ); } // End: Don't log logged-in users
Do yourself a favor and check out YOURLS
In all, my experience was rewarding: it was very easy to set up the YOURLS installation, once up I have a very configurable and fun URL shortener. I get to build links to a domain I control, which is nice for SEO.
1 reply on “YOURLS URL Shortener”
good suggestion. yourls is awesome. cant believe it has such a small following.