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.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.