I am actually using a RewriteMap
directive inside my vhost to redirect a list of 800 URLs. It works quiet well:
RewriteEngine On
RewriteMap redirects dbm=db:/data/apps/project/current/configuration/etc/httpd/conf/redirects.db
RewriteCond ${redirects:$1} !=""
RewriteRule ^(.*)$ ${redirects:$1} [redirect=permanent,last]
I use a redirect.txt
file containing the mapping. Then it is converted to a db file:
httxt2dbm -f db -i /data/apps/project/current/configuration/etc/httpd/conf/redirects.txt -o /data/apps/project/current/configuration/etc/httpd/conf/redirects.db
For example for this kind of URL, it is OK:
/associations/old_index.php /
But when the URL contains spaces it doesn't work: (I suppose it will be the same with other special characters)
/Universités%20direct /
How to handle this case?