http://www.hgesser.de/

Private Homepage von Hans-Georg Eßer

header

Navigation

Links / Social

Software

Blaue Links: intern
🔗 Rote Links: extern


mySSUS

my Simple Short URL Service

Navigation: description | reasons | setup | screenshot | download | limitations | license

What is it? Features

mySSUS is my Simple Short URL Service and it has the following features:

  • manage a hierarchical set of short URLs and their long translations
  • do not use a database
  • instead use simple ASCII files that can be created automatically or manually (whatever you prefer)
  • program is one Python file of ~ 3 KByte size
  • free software (GPL licensed)

Reasons for mySSUS; what the "database" looks like

Short URLs can be managed in a hierarchical way. The tool came into existence because I needed a short URL service for the magazine I work for (EasyLinux). This was the task: In

  • every issue of the magazine (first hierarchy layer) we have
  • several articles (second layer)
  • and each article has an info box with several links (third layer)
I searched for a tool that would let me create some kind of formatted file for each issue, giving the translations from short to long URLs. When finished with writing/creating that file it should be uploaded and be done with.

I found no such tool, now there is one (mySSUS).

This is a sample file:

a1	EasyLinux 04/2010

a1a	Erster Testartikel
a1a1	http://www.easylinux.de/
a1a2	http://www.linux-user.de/
a1a3	http://www.linux-magazin.de/

a1b	Zweiter Testartikel
a1b1	http://www.easylinux.de/
a1b2	http://www.linux-user.de/
a1b3	http://www.linux-magazin.de/
a1b4	http://www.linux-community.de/
Empty lines will be ignored, but you can enter them in order to make the data file readable. Separation of short and long URL happens with \t (tab) in this case, you can reconfigure mySSUS to use something different. However the separator should be something that will not appear anywhere else. If it does appear elsewhere, the tool breaks (it is "simple", as promised).

The short URLs have a syntax which represents the hierarchy mentioned above. In the example URL a1b4 the parts mean:

  • a1: issue (in my private notation that is: a=2010, 1=issue 1 of that year), use anything you like, it just has to be two characters long
  • b: article ID within that issue
  • 4: URL number within that article
Simple, isn't it? a2f9 would be the 9th URL in the "f" article of issue 02/2010.

The file contains header entries (a1, a1a, a1b in the example). The first one (a1) is required for the file, it names the issue. The other ones (a1a, a1b) name articles, and they will be shown in some situations if available.

Setup

In order to use mySSUS, you need to do three things:

  1. put the index.py from the archive in the document root of your Apache installation (or the virtual host's document root)
  2. modify the server/host configuration like this:
            Options ExecCGI +Includes FollowSymlinks
            AddHandler cgi-script .py
            RewriteEngine On
    
    (Some of the options may not be required; I started with an already existing virtal host definition, so you may be able to remove some of this.)
  3. put a file .htaccess in the document root like this:
    <IfModule mod_rewrite.c>
    RewriteEngine On
    RewriteBase /
    RewriteCond %{REQUEST_FILENAME} !-f
    RewriteCond %{REQUEST_FILENAME} !-d
    RewriteRule . /index.py [L]
    </IfModule>
    
    This basically maps every file request to index.py unless there's a file or directory by that name. So don't create other content on the same host that looks like a valid short URL.

Also you will have to provide at least one data file to make any use of the software, but it will work without one, just displaying the standard texts.

Screenshot

This is what it will look like. (The sample images shows what you see when using a short URL that cannot be found but seems to belong to an issue that is known. If you enter a correct short URL you will be redirected after two seconds.)

Download

mySSUS comes as a tar.gz archive containing index.py, a sample a1.data file and some documentation.

Versions:

Limitations

The code is simple. It hardly does any error condition checking. It will not crash when it cannot open a data file, but that is all you get. Documentation within the code is in German language.

License

mySSUS 0.1: my Simple Short URL Service
Copyright © 2010 Hans-Georg Eßer <h.g.esser *AT* gmx.de>

This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.

This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.

You should have received a copy of the GNU General Public License along with this program. If not, see http://www.gnu.org/licenses/.


Copyright © 1997-2024 Hans-Georg Eßer; Server: Debian Linux, Apache Web Server, letzte Änderung: Monday, 22-Jul-2013 22:14:47 CEST
Theme: Hazard Area 1.6 (modified), created by Bryan Bell, Copyright © 2000-2006 Weblogger.com.