在htaccess文件中,以下工作
redirect 302 /old.php http://somesite.com/new.php
但是跟随失败
redirect 302 /old.php?this=that http://somesite.com/new.php
我认为这是因为第二个版本包含查询字符串。我们如何重定向这样的URL?
请注意,目标URL格式不同,因此它不能成为自动规则,因此我需要编写将用户重定向到的自定义URL。
我在这里找到了类似的问题并得到了答复,但是建议的解决方案不起作用:
谢谢
您可以将此规则用作旧域的站点根.htaccess中的最高规则:
RewriteEngine On
RewriteCond %{QUERY_STRING} (?:^|&)this=that(?:&|$) [NC]
RewriteRule ^old\.php$ http://somesite.com/new.php? [R=301,L]
本文收集自互联网,转载请注明来源。
如有侵权,请联系 [email protected] 删除。
我来说两句