1

次のように、リダイレクトする必要があるリンクがいくつかあります。

/pass-help.php?action=1&email=test@test.com to /about/help
or
/contests/contest-a?testa=1&testb=1 /user/index/contest

上記のリンクでactionまたはを見つける方法が必要です。それらは何でもかまいません。email

/pass-help.php?action= (\?.+)&email= (\?.+)to /about/helpのようなものかもしれません

しかし、クエリ文字列の書き方がわかりません。

何か案は?

もしそうなら、何が起こっているのか理解できるように少し説明してください。

ありがとう

4

1 に答える 1

0

クエリ文字列が重要でない場合は、無視できます。

mod_alias 経由:

Redirect 301 /pass-help.php /about/help?
Redirect 301 /contests/contest-a /user/index/contest?

mod_rewrite 経由:

RewriteRule ^/?pass-help\.php$ /about/help? [L,R=301]
RewriteRule ^/?contests/contest-a /user/index/contest? [L,R=301]

mod_alias の場合、最後に stary があることに注意してください?。これは、クエリ文字列を取り除くために必要です。

クエリ文字列にいくつかのパラメーター名が必要であるが、値は気にしない場合:

mod_rewrite 経由:

RewriteCond %{QUERY_STRING} (^|&)action=
RewriteCond %{QUERY)STRING{ (^|&)email=
RewriteRule ^/?pass-help\.php$ /about/help? [L,R=301]

RewriteCond %{QUERY_STRING} (^|&)testa=
RewriteCond %{QUERY_STRING} (^|&)testb=
RewriteRule ^/?contests/contest-a /user/index/contest? [L,R=301]

クエリ文字列に、正確な値を持つパラメーター名が必要な場合:

RewriteCond %{QUERY_STRING} (^|&)action=1
RewriteCond %{QUERY)STRING{ (^|&)email=test@test.com
RewriteRule ^/?pass-help\.php$ /about/help? [L,R=301]

RewriteCond %{QUERY_STRING} (^|&)testa=1
RewriteCond %{QUERY_STRING} (^|&)testb=1
RewriteRule ^/?contests/contest-a /user/index/contest? [L,R=301]
于 2012-09-26T21:48:03.033 に答える