2013-05-29 43 views
1

我想所有的交通肇事来自http://www.example.com来重定向到http://www.mysite.com/badreferer.aspx?bad=trueURL重写 - 错误此网页有重定向循环

为了这个,我试图创建在IIS7的http://www.mysite.com web.config文件的规则。

<rule name="bad referer" stopProcessing="true"> 
     <match url="(.*)" /> 
     <conditions> 
        <add input="{HTTP_REFERER}" pattern="(.*)example(.*)" /> 
     </conditions> 
     <action type="Redirect" url="/badreferer.aspx?bad=true" appendQueryString="false" />   
    </rule> 

但有重定向循环的问题。

请帮忙。

谢谢。

回答

1

试试这个:

<rules> 
    <rule name="bad referer" stopProcessing="true"> 
    <match url="^(.*)" /> 
    <conditions> 
     <add input="{HTTP_REFERER}" pattern="http://www.example.com(.*)" negate="true" /> 
    </conditions> 
    <action type="Redirect" url="http://www.website.com/badreferer.aspx?bad=true" /> 
    </rule> 
</rules> 

更新:

<rule name="bad referer" stopProcessing="true"> 
    <match url=".*" /> 
    <conditions logicalGrouping="MatchAll" trackAllCaptures="true"> 
     <add input="{REQUEST_URI}" pattern="/badreferer\.aspx?bad=true" negate="true" /> 
     <add input="{HTTP_REFERER}" pattern="^www.\example\.com.*" /> 
    </conditions> 
    <action type="Redirect" url="/badreferer.aspx?bad=true" appendQueryString="false" /> 
</rule> 
+0

什么是站点B在这里?更多,这不会解决我的问题。 – Maddy

+0

对不起,我编辑我的例子 –

+0

不起作用,它将我的网站的所有链接重定向到该网址 – Maddy

相关问题