Con RewriteMap tutto è possibile:
RewriteMap examplemap prg:/path/to/file.php
RewriteRule (.*) ${examplemap:$1}
Puoi utilizzare mod_dbd anche:
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}