RedirectMatch ^/bot/([0-9A-Z]{10})/ http://example.com/asin/$1/ RewriteEngine On RewriteRule ^asin/([0-9A-Z]{10})/$ go.cgi?asin=$1 [L] RewriteCond %{HTTP_USER_AGENT} bot|ahoo|craw|spid [NC] RewriteRule ^asin/([0-9A-Z]{10})/(.+-22)/$ bot/$1/ RewriteRule ^asin/([0-9A-Z]{10})/(.+-22)/$ go.cgi?asin=$1&aid=$2 [L]
http://example.com/asin/00000000/yto-22/にアクセスすると
http://example.com/go.cgi?asin=00000000&aid=yto-22が実行される。
http://example.com/bot/00000000/にリダイレクトされ、それが
http://example.com/asin/00000000/にリライトされ、最終的に
http://example.com/go.cgi?asin=00000000が実行される。
RewriteEngine On RewriteRule ^asin/([0-9A-Z]{10})/$ go.cgi?asin=$1 [L] RewriteCond %{HTTP_USER_AGENT} bot|ahoo|craw|spid [NC] RewriteRule ^asin/([0-9A-Z]{10})/(.+-22)/$ /asin/$1/ [R=301] RewriteRule ^asin/([0-9A-Z]{10})/(.+-22)/$ go.cgi?asin=$1&aid=$2 [L]