比较这两个RedirectMatch。第一个不起作用:
RedirectMatch 302 ^/redirect\.php[?]page=(.+)$ http://somewhereelse.com/$1
Run Code Online (Sandbox Code Playgroud)
与此相反,它将重定向到http://somewhereelse.com/?page=wherever:
RedirectMatch 302 ^/redirect\.php([?]page=.+)?$ http://somewhereelse.com/$1
Run Code Online (Sandbox Code Playgroud)
是否RedirectMatch只匹配 URI 而不是查询字符串?Apache 的文档在这方面有点含糊。我想要做的是提取page查询参数并使用它重定向到另一个站点。
这是可能的RedirectMatch还是我必须使用RewriteCond+ RewriteRule?