2012-02-20 127 views
1

我有一個URL像http://localhost/test.html?param1=a&param2=b&param3=c 我想重寫條件檢查查詢參數參數1,參數2和參數3可以在任何order..it也能像下面阿帕奇國防部,重寫規則條件持倉

http://localhost/test.html?param3=a&param2=b&param1=c 
http://localhost/test.html?param2=a&param3=b&param1=c 
http://localhost/test.html?param3=a&param1=b&param2=c 

請幫助我如何重寫此查詢字符串的條件..我可以用[OR]條件編寫所有組合,但是有沒有最好的方法來實現這個?

感謝

回答

0

寫這樣的:

RewriteCond %{QUERY_STRING} (^|&)param1=[^&]*(&|$) [NC,OR] 
RewriteCond %{QUERY_STRING} (^|&)param2=[^&]*(&|$) [NC,OR] 
RewriteCond %{QUERY_STRING} (^|&)param3=[^&]*(&|$) [NC] 
RewriteRule ^test\.html$ target-uri-goes-here? [NC,L]