使用参数将带参数的URL重定向到另一个URL

时间:2017-03-07 16:21:58

标签: .htaccess redirect

使用htaccess,我想重定向

index.php?page=search&action=go&string=John+Doe

search.php?string=John+Doe

但仅当page = search and action = go in first url(string vary)

感谢任何帮助,谢谢。

1 个答案:

答案 0 :(得分:3)

使用以下规则,

RewriteCond %{QUERY_STRING} ^page=search&action=go&string=(.+?)$
RewriteRule ^ /search.php?string=%1 [R=301,L]