我想根据get参数将url重定向到不同的位置,似乎只有第一个规则才能生效,而其余的则被忽略。
http://example.com/def?attachment_id=365 http://example.com/abcdef
http://example.com/def?attachment_id=360 http://example.com/hujkl
以下是我正在使用的代码:
RewriteCond %{QUERY_STRING} ^attachment_id=365$
RewriteRule ^def/$ http://example.com/abcdef [L,R=301]
RewriteCond %{QUERY_STRING} ^attachment_id=360$
RewriteRule ^def/$ http://example.com/hujkl [L,R=301]
答案 0 :(得分:0)
RewriteCond %{QUERY_STRING} attachment_id=365
RewriteRule ^$ http://example.com/? [L,R=301]
RewriteCond %{QUERY_STRING} page_id=8
RewriteRule ^$ http://example.com/def? [L,R=301]