Tinyurl is a project mainly written in C++ and SHELL, it's free.
tinyurl is a bare bones url shortening tool written in C++ and bash script
tinyurl is a bare bones url shortening tool written in C++ and bash script. The redirects are handled by a C++ program (using FastCGI protocol) and managing url's is done with the bash script.
I wrote this tool to see just how simple it would be to write the most basic url shortener. There is nothing fancy going on here: long url's are stored in files, minimal error handling (404 Not Found and 400 Bad Request), no hit tracking.
I chose to write a raw CGI program instead of using a higher level scripting language due to simplicity of the app. This also means that requirements are simple; just a competent HTTP server capable of running FastCGI programs.
Makefile
settings as necessary (see Buildtime settings)tinyurl.fcgi
to your web directorytinyurl
script to somewhere in the path, eg: ~/bin
Makefile
has a few settings that should be tweaked to suit your server:
tinyurl.fcgi
(including trailing forward slash)Install and enable mod_fcgid.
Optionally use the following .htaccess
to rewrite all requests in a given
directory/location to the tinyurl.fcgi script. If tinyurl.fcgi is in a location
other than the root of the domain adjust the path in ReweriteRule
appropriately.
Options +ExecCGI
AddHandler fcgid-script .fcgi
RewriteEngine On
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^(.*)$ /tinyurl.fcgi/$1 [L]