Getting the most out of Lessn
September 23rd, 2009 | Tutorials
As I wrote about a little while ago, I’ve been using my own RLE.me URL shortener, powered by Lessn (app install notes here, and info about the update here). If ridiculously hyper sentences like that aren’t convincing enough, linking and how we link is very important.
I have been loving Shaun Inman’s script so much that I was getting really miserly about how I was using the precious first 35 short URLs that have only one character (disappointingly symbols and capitalized characters aren’t used. I think that’s a function of base_convert). In fact, to make sure I’m using them wisely I just “reserved” the last 12 single character URLs for manual use, or maybe installing Lessn again under something like rle.me/x/ as the tutorial suggests, instead of in the root!
One great way to make sure you’re getting the most out of Lessn is to make sure you don’t shorten a URL more than once! It could happen so easily as I discovered. You get talking about a site or project, and you want to share the brilliantly shortened link. But what was that Lessn URL again? Then you waste time searching back… was it H? G? 5? It would be too tempting to shorten it again.
To solve this minor issue I wrote a page to be added to Lessn called listr.php. Listr basically digs into the database to list all the original URLs and the shortened URL.
This couldn’t be easier to add to your Lessn install. Simply download the listr.zip file, uncompress it and FTP it to http://yourdomain.com/-/ Once you login and go to http://yourdomain.com/-/listr.php you will see all of the URLs you’ve shortened over time. Download Listr.zip
Note, this Listr page isn’t private, and anyone who browses to it will be able to see your list. I figure that’s fine, as anyone who can see your Short URL can guess the other short URLs. To make your Listr private include the “index.php” (which has session sniffing cookie action) and scrap the then redundant includes like config.php and db.php. You can then also remove the defines on LESSN_URL and LESSN_DOMAIN.
The results are listed in a table which you can customize. For instance you might not want your ID column, and you might want the short URL to be a link (I commented this out).
Note, I’m not a “PHP Poet” so maybe some of the server calls and code could be made more elegant. Maybe pagination or search will become an issue once you’ve had Lessn installed for a while. If you make some improvements please let me know, I’d love to share it here.