htaccess条件会破坏其他图像和页面


htaccess condition destroys other images and pages

我使用下面的htaccess代码,这样当用户键入www.current_website.com/go或www.current_wwebsite.com/go/时,他们会转到另一个网站www.other_website.com

RewriteRule go http://www.other_website.com
RewriteRule go/ http://www.other_website.com

问题是logo.jpg图片,因为它包含go没有出现当在current_website中访问logout.php页面(也包含go)时,它会转到www.other_website.com

如何解决这个问题?

您需要通过将go锚定在起点和终点来确保它就是全部。我还让斜线是可选的,所以你只需要一条规则:

RewriteRule ^go/?$ http://www.other_website.com
                 ^ the end of the path
               ^^ optional slash
            ^ the start of the path

也许用?

RewriteRule http://www.current_website.com/go http://www.other_website.com
RewriteRule http://www.current_website.com/go/ http://www.other_website.com