In httpd.conf:
RewriteEngine On
RewriteMap urlshort txt:/path/to/file/map.txt
RewriteRule ^/s/([a-zA-Z0-9]+)$ ${urlshort:$1} [R]
in map.txt:
abcdef http://www.foo.com/blah/
bcdefg http://www.bar.com/foo/
The RewriteRule can be tweaked (removing the /s, using a fixed-length key, whatever) as long as whatever matches in the parens is the key to the map.txt table. And map.txt could be a different kind of map (including an external program that looks the key up in a DB, logs the request, etc.)
Advertisements