Multiple files for apache RewriteMap

by FelixHJ   Last Updated September 11, 2019 14:00 PM

I currently have this (2 files with redirects, same rules for both)

RewriteMap test "txt:/tmp/redirects.txt"
RewriteCond %{REQUEST_URI}           ^(.*)$
RewriteCond ${test:%1|NOT_PRESENT}  !NOT_PRESENT [NC]
RewriteRule .?                       ${test:%1} [NC,R=301]

RewriteMap test2 "txt:/tmp/redirects2.txt"
RewriteCond %{REQUEST_URI}           ^(.*)$
RewriteCond ${test2:%1|NOT_PRESENT}  !NOT_PRESENT [NC]
RewriteRule .?                       ${test2:%1} [NC,R=301]

Is there any way to simplify it so I get one map with set of rules but load redirects from both files? RewriteMap dont accept multiple files in one go it seems.



Related Questions


Apache settings to prevent browser from redirect

Updated March 07, 2018 10:00 AM

apache2 mod_rewrite redirect without http body

Updated April 04, 2018 19:00 PM

.htaccess 301 redirect remove [] from the URL

Updated August 13, 2018 15:00 PM

Redirect https://www to https://

Updated July 17, 2018 11:00 AM

Apache2: two redirects

Updated January 09, 2019 23:00 PM