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.
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.cgiand 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 behttp://neologasm.org/tiny.cgi?q=url to shortenand the URLs it makes would behttp://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/tequivalent to the tiny.cgi URL above, for URLs as short as possible.