我有以下重写规则,它们会重写到同一个位置:
RewriteRule %{QUERY_STRING} ^staff=test-edu-trust$
RewriteRule ^/finance/payroll/forms/salary-payment-form.shtml$ https://www.test.com/finance/BBBB.shtml?staff=test-edu-trust[R=301,L,NC]
RewriteRule %{QUERY_STRING} ^staff=test-comm-rac$
RewriteRule ^/finance/payroll/forms/salary-payment-form.shtml$ https://www.test.com/finance/BBBB.shtml?staff=test-comm-rac[R=301,L,NC]
问题是重写到同一位置 - https://www.test.com/finance/BBBB.shtml?staff=test-edu-trust
如果我将规则的顺序更改为以下,则他们最终会按顺序重写到第一个位置:https://www.test.com/finance/BBBB.shtml?staff=test-comm-rac,如下所示:
RewriteRule %{QUERY_STRING} ^staff=test-comm-rac$
RewriteRule ^/finance/payroll/forms/salary-payment-form.shtml$ https://www.test.com/finance/BBBB.shtml?staff=test-comm-rac[R=301,L,NC]
RewriteRule %{QUERY_STRING} ^staff=test-edu-trust$
RewriteRule ^/finance/payroll/forms/salary-payment-form.shtml$ https://www.test.com/finance/BBBB.shtml?staff=test-edu-trust[R=301,L,NC]
这里导致规则顺序的原因只是重写为第一个定义的,因为我认为QUERY_STRING会抓住这个并将哪个url重写为??
答案 0 :(得分:0)
注意到我有RevingRule而不是RewriteCond用于QUERY_STRING !! Doh !!!