0

我想301

domain.com/?test-article.php

domain.com/full-article/test-article.php

这是我正在尝试使用的代码,但它不起作用。

redirect 301 /?test-article.php http://domain.com/full-article/test-article.php

或者

rewriteRule /?test-article.php http://domain.com/full-article/test-article.php [R=301,L]

如果我不使用“?” 然后它从

/test-article.php

http://domain.com/full-article/test-article.php

所以与“?”有关。

4

1 回答 1

0

您无法使用 aRedirect或的模式匹配查询字符串RewriteRule。您需要使用%{QUERY_STRING}变量和 mod_rewrite:

RewriteCond %{QUERY_STRING} ^test-article$
RewriteRule ^/?$ http://domain.com/full-article/test-article.php [R=301,L]
于 2012-12-27T09:56:23.977 回答