Tiny

You may have seen notlong.com's convenient comparison of URL shortening services. But what if you want to run one yourself, just for your own use, or so that when it's broken it's your fault? As you might guess the basic function is just an hour or two of Perl hacking, at least if you waste inodes using the filesystem for your database. (I recall Makali did one in PHP a while back but I don't know if he still has it.)

Obviously running it yourself is both a blessing and a curse. I'm not gunning after any of the fine public shortening services already in existence. I doubt you have an URL as short as ek.dk, for one, but most of them trounce this wee script on features as well; check out the chart to see what cool stuff the public services do (EFnet bot?). But a friend asked, and another friend said I could prolly whip it up in 90 seconds or so; it was more like 90 minutes but it was still a welcome favor to a friend. Feel free to find your own use for it.

TrackBack

Listed below are links to weblogs that reference Tiny:

» Web Sites That Shorten Long URLs from a little ludwig goes a long way
Via Mark, a comparison of Web Sites That Shorten Long URLs. These things are proliferating like weeds. And a basic system can be done easily, I guess it won't be long til we are all running one of these services... [Read More]

» Mid-week Feast of Links from Brainstorms and Raves
The harsh reality is that there are so many good sites, articles, resources, posts out there. I can understand why sideblogs with just links in them are spreading in popularity. At any rate, here are some terrific resources that I've been wanting to sh... [Read More]

» doesn't fit elsewhere from Snapping Links II (The Revenge)
tiny, my day, and feed on feeds. [Read More]

» Shortening URL's from Absoblogginlutely
Mark has a page about shortening urls but with a domain like absoblogginlutely.net its likely to increase the length of the resulting url!... [Read More]

Comments

comment

Could you write a wee bit more about it — basic information like how to name the script and where to put it? It sounds very interesting and I would love to play around with it, but unfortunately I’m not much of a Perl user.

comment

Sorry. :)

You can call it tiny.cgi and put it wherever you can run CGI programs. Here on Cornerhost we can run them wherever. If you have to put programs in a cgi-bin, that’ll make the URL a bit longer, so it won’t work as well—but if you have to, you have to, eh?

Anyway, if I put it at http://neologasm.org/tiny.cgi, then I would go to that URL to get a form where I could paste in an URL and hit the submit button (as well as a bookmarklet link). The URL to request shortening would be http://neologasm.org/tiny.cgi?q=url to shorten and the URLs it makes would be http://neologasm.org/tiny.cgi/code. The codes are strings of letters a-z that get progressively longer as you fill up the alphabet. (It doesn’t perfectly start with a then count up to z, then aa, but it doesn’t need to be perfect.)

Because tiny uses PATHINFO when given a code, it may not work with an out-of-the-box IIS installation. IIS tends to have problems with PATHINFO. On Apache you can use mod_rewrite to make http://neologasm.org/t equivalent to the tiny.cgi URL above, for URLs as short as possible.