Mercurial > hg > egg-tcls
changeset 88:7ed449f9b848
Add documentation for short URL redirector.
author | Matti Hamalainen <ccr@tnsp.org> |
---|---|
date | Mon, 12 Sep 2011 03:02:18 +0300 |
parents | 97c56d1e9ce2 |
children | 77e05ce9e9b8 |
files | urlredirect.php.txt |
diffstat | 1 files changed, 28 insertions(+), 5 deletions(-) [+] |
line wrap: on
line diff
--- a/urlredirect.php.txt Mon Sep 12 01:52:05 2011 +0300 +++ b/urlredirect.php.txt Mon Sep 12 03:02:18 2011 +0300 @@ -1,10 +1,33 @@ <? -// ========================================================== -// URLLog PHP-script for redirecting ShortURLs -// (C) Copyright 2006-2011 Tecnic Software productions (TNSP) -// ========================================================== +/* ========================================================== + * URLLog PHP-script for redirecting ShortURLs + * (C) Copyright 2006-2011 Tecnic Software productions (TNSP) + * ========================================================== + * How to set up short URL redirection: + * + * 1) Set up URLLog database (see urllog.tcl for more information) + * + * 2) In this example we assume that your short URL prefix is: + * http://example.com/u/ + * This setting is called urllog_shorturl_prefix in urllog.tcl + * + * 3) Place this PHP script under your www-server root. In this + * example we will use "/var/www/urlredirect.php" that is + * visible as http://example.com/urlredirect.php + * + * Edit script dbFilename setting below to point to correct + * URLLog SQLite database file location. + * + * 4) Create or edit /var/www/.htaccess and add following: + * RewriteEngine on + * RewriteRule ^u/([^\?\&]+)$ /urlredirect.php?u=$1 + * + * 5) You may need to restart/reload your www-server. + * + * 6) Profit. + */ // SQLite3 database file path and name -$dbFilename = "../db/urllog.sqlite"; +$dbFilename = "/path/to/urllog.sqlite"; // ========================================================== // Helper functions