RewriteMap uses a text file as a convenient alternative for the administrator when declaring many rewrite rules. Code based on the article from ONLamp.com - A Day in the Life of #Apache http://urltea.com/1vwb
<file name="links.txt" location="/var/www/localhost/"> scotsman /gwd/feed/scotsman.html digg /gwd/feed/digg.html </file> <IfModule mod_rewrite.c> RewriteEngine on RewriteMap links txt:/var/www/localhost/links.txt RewriteRule ^/l/(.*) ${links:$1|http://mysite.com/} [R] </IfModule>
Note: The [R] at the end of RewriteRule means redirect, to have a clean url simply remove that switch.
*update 15-Feb-08 *
Restart Apache rather reloading the module when switching redirection on or off for a RewriteRule. The Apache version 2.2.6 (Unix) didn't pick up my settings correctly when I tried /etc/init.d/apache2 reload, instead I needed to use /etc/init.d/apache2 restart.