<?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>
In the above example, resources are displayed normally only when test.com and fengzili.com are used to access this website.
At the bottom, the rule is to map RMBs in the URL to the output in the readm2e.txt file.
Strongly thanks to the http://www.cnblogs.com/shuaixf/p/3414136.html this brother code, silly Microsoft get this thing, I configured many times life and death can not, copy it over it (Environment: windows2012 iis7)
Using urlrewriter for image anti-leech protection in IIS