我们已使用带有QUERY_STRING参数的源和目标实现了rewritemap。它可以与Rewritemap文件(redirect_map.txt)中的内容配合使用。
RewriteEngine on
RewriteMap rdm txt:/opt/app/apache/WWW/conf/redirect_map.txt
RewriteCond %{QUERY_STRING} !=""
RewriteCond %{REQUEST_URI} !=""
RewriteCond ${rdm:%{REQUEST_URI}?%{QUERY_STRING}|NOT_FOUND} !=NOT_FOUND
RewriteRule ^.*$ https://mydomainccccc.com${rdm:%{REQUEST_URI}?%{QUERY_STRING}}? [R=302,L,NE,NC]
redirect_map.txt中的示例内容:
/Wheels/Wheel-Spacers-and-Adapters.aspx?t_c=11&t_s=107&t_pt=7576 /b/tires-wheels/wheel-spacers-adapters/_/N-cm5ba
/Wheels/Moto-Metal-Wheels.aspx?t_c=11&t_s=210&t_pt=100100 /b/tires-wheels/wheels/moto-metal/_/N-cm5b1Z1z0adhf
但是,如果在源URL的末尾添加了额外的QUERY_STRING参数,那么我们将获得404页。
带有额外QUERY_STRING参数的示例:(&utm_medium = 1234&utm_source = google)
来源网址: http://mydomainccccc.com/Wheels/Moto-Metal-Wheels.aspx?t_c=11&t_s=210&t_pt=100100 &utm_medium = 1234&utm_source = google
非常感谢您的帮助
谢谢