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

时间:2015-04-02 08:02:25

标签: php .htaccess

我正在使用以下htaccess代码,因此当用户输入www.current_website.com/go或www.current_website.com/go/时,他们会访问另一个网站www.other_website.com

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

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

如何解决这个问题?

2 个答案:

答案 0 :(得分:0)

您需要通过将go锚定到开头和结尾来确保RewriteRule ^go/?$ http://www.other_website.com ^ the end of the path ^^ optional slash ^ the start of the path 。我还将斜杠设为可选,因此您只需要1条规则:

{{1}}

答案 1 :(得分:0)

也许用?

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