Polr, URL Shortener, kissa.be, and others

Self-Hosted Scripts for an URL Shortener: polr and Others

In the last part of this series of short articles on setting up your own URL shortener, we briefly review other self-hosted scripts for URL shorteners: polr, URL Shortener, and kissa.be.

Polr

We start by polr, the most recent URL shortener: work at polr started in 2013. Besides a convenient installer and a public shortener interface, polr supports user accounts along with a fully responsive design based on Bootstrap. The newest (unstable) 2.0.0xx pre-releases also include an API and aim at rate limiting. On the downside, the coding style of the current stable version 1.5.1 is not as skilled as that of YOURLS or tr.im, and the access statistics are simple visitor counters, without any graphical illustration of e.g. the geo-location of the visitors. Access stats in polr are always public, i.e. never private to the creator of a link, and there is no plugin architecture.


Polr URL Shortener Start Page

Like tr.im and YOURLS, polr supports custom short URLs, which become available after the “Link options” button has been clicked. Another nice extra is the support of secret short URLs: once toggled to “Secret”, polr creates short URLs like e.g. http://polr.me/z3p?Trtl with a secret password Trtl for accessing http://polr.me/z3p. This is very similar to a feature of tr.im that we had already seen (however, tr.im allows to choose your own password, whereas polr generates a random one).

Polr Options

After shortening, a custom or incremental short URL is created (polr currently does not allow for random URLs):

Polr short URL

As has been mentioned before, polr stats are simple and they are always publicly accessible:

Polr public statistic pages

If you are on version 1.5.1 of polr, the user panel looks like this:

Panel of polr v1.5 stable

The (unstable) pre-releases of polr 2.0.0xx however show a new tab in the user panel called “Developer”:

Polr v2.0 developer tab

Clicking the developer tag reveals new options for an API, including an API key and an API rate limit:

Polr API options and API key

URL Shortener by DT Netsolution

Next, after this outlook for the future of polr, we take a short look at a neat piece of open source software aptly named “URL Shortener“. It was written by the German company DT Netsolution GmbH, and is offered only in German language. It features custom short URLs or random short URLs like e.g. http://urlshorten.er?28368 (and no, there is no such top level domain as .er, this is just an example). In contrast to all previously discussed shortener solutions, URL shortener assumes that only the admin can create user accounts. In this respect a truly public interface is not supported. URL shortener is a small and nice solution whenever a closed user group needs to shorten links for their daily work, e.g. think of the staff of a library.

URL Shortener by DT Netsolution GmbH

Additional features are:

  • responsive design based on Bootstrap
  • integrated user role model (admin vs. normal users)
  • automated link expiry
  • protecting links against deletion

Kissa.be

The last item in our brief review of open source solutions for URL shorteners and pastebins is kissa.be. Kissa.be was pretty popular when it was published in 2008, but unfortunately development has already been canceled. It provides a very nice public interface with multiple options including, but not limited to the shortening of URLs (we will look into this in more detail later). It was written in PHP and smarty, and so a bunch of templates are ready to be edited, facilitating any desired adaption of the design. On the other hand, kissa.be does neither ship with a responsive design, nor does it support user accounts or private statistics (and stats are simple visitor counts anyway). Nonetheless, the nifty, multi-functional public interface (see below) was probably a good reason why kissa.be had once gained much interest.

Kissa.be URL shortener

As illustrated above, the kissa.be interface allows for the shortening of URLs, emails, text, and images. We start by shortening an URL. Next, you see the info page of the shortened URL. It can be accessed by appending a “-” sign to the short URL, e.g. like so: http://kissa.be/s-.

Kissa.be shortened URL

Kissa.be also displays access statistics (as a simple visitor counter) to the right of the toolbar. However, there is no user management and so stats are always publicly accessible. Since we believe in private stats, the counter has been removed in our demo.

And now: how about shortening an e-mail? This may first sound absurd as an e-mail is usually not very long. But in fact “leaving your email as plain text in forums, on Twitter or on classified sites makes you an easy spam target”, and the idea of scr.im is to protect e-mail addresses against this—for a more detailed explanation see here. On a side note, scr.im is based on YOURLS (not kissa.be), and was built by the author of YOURLS.

Kissa.be: Shortening an E-Mail

The created short URL redirects your browser to the canonical URI for the targeted e-mail address, e.g. to mailto:info@bestna.me. Provided that you have a default e-mail reader installed, this should fire it up:

Kissa.be: shortened e-mail

Notice that more would need to be done to mimic the behavior of scr.im: to keep bots from scanning your e-mail address, a visitor should pass a captcha test before access to the e-mail URI can be granted. But that should be easy enough to add.

Kissa.be also allows shortening text. Here, we will be shortening lines 1–5 of a well-known poem of Samuel Taylor Coleridge:

Kissa.be: shortening text

On visit of the created short URL, the kissa.be software lets your browser display the text (here, shown as the respective info page with toolbar, invoked by appending a “-” to the short URL again):

Kissa.be: shortened text

Last but not least, kissa.be can also be used to shorten images! The images will be hosted on your webserver, and users can upload them either by giving the URL of an image on the web, or by uploading it from the local hard disk of their computer. In the following, we will simply use an image already on the web:

Kissa.be : shortening an image from the web

Not surprisingly, kissa.be displays the image when visiting the created short URL (or, like below, its info page):

Kissa.be: Shortened Image from the Web

The End

This ends our little tour through the various self-hosted solutions for URL shorteners and pastebins.

The end. This is it.