Mod rewrite 重写导致重定向的规则

Mod rewrite 重写导致重定向的规则,mod-rewrite,redirect,iis-7.5,robots.txt,isapi-rewrite,Mod Rewrite,Redirect,Iis 7.5,Robots.txt,Isapi Rewrite,我有iis7.5和ISAPI_重写(Helicon) 我正在尝试这样做,以便来自每个托管站点的robots.txt都是相同的 为此,我有一个虚拟站点(sometestsite.com),其中包含robots1.txt(我希望在其他站点上重用) 我有以下规则: RewriteRule ^(.*)/robots.txt$ http://sometestsite.com/robots1.txt 当我请求http://sometestsite.com/robots.txt它显示http://somet

我有iis7.5和ISAPI_重写(Helicon)

我正在尝试这样做,以便来自每个托管站点的robots.txt都是相同的

为此,我有一个虚拟站点(sometestsite.com),其中包含robots1.txt(我希望在其他站点上重用)

我有以下规则:

RewriteRule ^(.*)/robots.txt$ http://sometestsite.com/robots1.txt
当我请求
http://sometestsite.com/robots.txt
它显示
http://sometestsite.com/robots1.txt
如预期,但当我请求
http://completelydifferentsite.com/robots.txt
它将我重定向到
http://sometestsite.com/robots1.txt


我做错了什么?此外,如果这里有实现我目标的另一种方法,我将非常感谢听到。

你在哪里有这个规则。htacess?此规则位于ISAPI_Rewrite文件夹中的httpd.conf中,此规则适用于所有托管站点。比您需要的更多:RewriteCond%{HTTP:Host}^(.*)[NC]RewriteRule^(.*)/robots.txt$HTTP://%1/robots1.txt谢谢您的回答,但不幸的是,它并不能解决我的问题,因为我不想在每个站点上都有robots.txt和robots1.txt。我只想在站点A上托管一个文件robots1.txt,当请求每个站点(A、B、C…)的robots1.txt时,它应该提供A/robots1.txt的内容。因此,在我的示例中,当我请求A/robots.txt时,我的url是A/robots.txt,内容是A/robots1.txt,但当我请求B/robots.txt时,它会将我重定向到A/robots1.txt,但我希望url是B/robots.txt,内容是A/robots1.txt。