パラメータ付きの特定の URL を別のドメインにリダイレクトしたい
http://domain.tld/buy/?w=X1234からhttp://anotherdomain.tld/product.php?id=X1234 へ
ここに私のhtaccess
RewriteCond %{REQUEST_URI} !^/*buy/(.*)$ [NC]
RewriteRule ^/*buy/?w=([a-zA-Z0-9]+)$ http://anotherdomain.tld/product.php?id=$1 [NC,L,R=301]
しかし、機能していません。おそらく問題は param ?w= です
ありがとうございました
更新: How to REGEX and .htaccess rewrite url を読んだ後、クエリ文字列を使用して問題を解決します
RewriteCond %{QUERY_STRING} ^w=([a-zA-Z0-9]+)$
RewriteRule ^/*buy/$ http://anotherdomain.tld/product.php?id=%1 [NC,L,R=301]
スタックオーバーフローと皆さん、ありがとう!ここから正規表現を理解し始めます^_^