Avec RewriteMap tout est possible :
RewriteMap examplemap prg:/path/to/file.php
RewriteRule (.*) ${examplemap:$1}
Vous pouvez utiliser mod_dbd aussi :
DBDriver mysql
DBDParams "host=localhost,user=db_user,pass=password,dbname=db"
RewriteMap myquery "dbd:select new_url from rewrite where old_url = %s"
RewriteRule (.*) ${myquery:$1}