
大家好,又见面了,我是你们的朋友全栈君。
<?xml version="1.0" encoding="UTF-8"?>
<configuration>
<system.webServer>
<staticContent>
<clientCache cacheControlMode="UseMaxAge" cacheControlMaxAge="365.00:00:00" />
</staticContent>
<rewrite>
<rules>
<rule name="RequestBlockingRule1" enabled="true" stopProcessing="true">
<match url=".*" />
<conditions>
<add input="{HTTP_REFERER}" pattern="^$" negate="true" />
<add input="{HTTP_REFERER}" matchType="Pattern" pattern="^http://(.*\.)?(test\.com)/.*$" ignoreCase="true" negate="true" />
<add input="{HTTP_REFERER}" matchType="Pattern" pattern="^http://(.*\.)?(fengzili\.com)/.*$" ignoreCase="true" negate="true" />
</conditions>
<action type="CustomResponse" statusCode="404" />
</rule>
<rule name="Readme" patternSyntax="ECMAScript" stopProcessing="true">
<match url="rm" />
<action type="Rewrite" url="readm2e.txt" />
</rule>
</rules>
</rewrite>
</system.webServer>
</configuration>上面的实例中只有用test.com和fengzili.com来访问这个网站的时候,资源才会正常显示。
底下那个规则是把url中有rm的都映射到readm2e.txt文件中输出。
强烈感谢 http://www.cnblogs.com/shuaixf/p/3414136.html 这个兄弟的代码,傻逼微软弄的这个东西,我自己配置好多遍死活不行,拷贝过来就可以了(环境:Windows2012 IIS7)
转载于:https://www.cnblogs.com/yanyuge/p/3967117.html
发布者:全栈程序员栈长,转载请注明出处:https://javaforall.cn/163503.html原文链接:https://javaforall.cn