私はのURLをQUERY_STRING
またはREQUEST_URI
というURLで別のWebサイトに転送し、他の呼び出しを無視したいと考えています。例えばQUERY_STRINGまたはREQUEST_URIが空でない場合にのみRewriteRule転送
:
http://X.com/images >> http://Y.com/images
http://X.com/?action=show >> http://Y.com/?action=show
http://X.com/ >> http://X.com/ // Or Ignore
誰も私を助けることができますか? QUERY_STRING
がREQUEST_URI
パラメータの一部である
RewriteEngine on
#redirect /?querystring to http://y.com/?querystring
RewriteCond %{QUERY_STRING} .+
RewriteRule ^$ http://y.com/ [L,R]
#/anyUri to http://y.com/anyUri but exclude the root
RewriteRule ^.+ http://y.com%{REQUEST_URI} [L,R]
ありがとうございました、私はあなたのコメントごとにコードを更新しましたREQUEST_URI –
任意のQUERY_STRINGをターゲットにしています。役に立った – starkeen
グレート.. {REQUEST_URI]に必要なだけのマイナーな修正をいただき、ありがとうございます>> {REQUEST_URI} –