我在名为“ map.txt”的映射文件中有一个URL映射列表,其内容如下:
find-a-partner/company-profile/?profileID=27
https://www.example.com/integrations/payment-processing/dp-checkscan/
find-a-partner/company-profile/?profileID=79 https://www.example.com/integrations/auctions-events/agile-ticketing/
我想要实现的是,当输入此“ https://test-connect.example.com/find-a-partner/company-profile/?profileID=27”时,应将其重定向到地图文件中列出的此URL:“ https://www.example.com/integrations/payment-processing/dp-checkscan/”。我尝试使用以下代码,但未正确重定向
# Match back to URI + QUERY string in the MAPFILE
RewriteCond %{REQUEST_URI} (.*)
RewriteCond %{QUERY_STRING} (.*)
RewriteCond ${mapfile:%1\x3f%2|NOT_FOUND} !NOT_FOUND
RewriteRule . ${mapfile:%1\x3f%2} [NC,NE,R=301,L]
# Match back to QUERY string in the MAPFILE
RewriteCond %{QUERY_STRING} (.*)
RewriteCond ${mapfile:%1|NOT_FOUND} !NOT_FOUND
RewriteRule .? ${mapfile:%1} [NC,NE,R=301,L]