2017-01-31 9 views
1

getパラメータに基づいてURLを別の場所にリダイレクトしたい場合は、最初のルールがこれを処理するように見えますが、残りは無視されます。以下は.htaccess get paramteresに基づいて別の場所に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
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] 
関連する問題