防盗链
为了防止您的图片被其他网站链接,你可以在网站根目录建立一个 web.config 文件
并把 以下内容粘贴进去。 请把 www.YourDomain.com改成您的域名。
ex:/www/site1/web.config
<?xml version="1.0" encoding="UTF-8"?>
<configuration>
<system.webServer>
<rewrite>
<rules>
<rule name="Prevent image hotlinking" enabled="true" stopProcessing="true">
<match url=".*\.(gif|jpg|png)$" />
<conditions>
<add input="{HTTP_REFERER}" negate="true" pattern="^$" />
<add input="{HTTP_REFERER}" negate="true" pattern="http://www.YourDomain.com/.*" />
<add input="{HTTP_REFERER}" negate="true" pattern="http://YourDomain.com/.*" />
</conditions>
<action type="Rewrite" url="/images/hotlinking.jpg" />
</rule>
</rules>
</rewrite>
</system.webServer>
</configuration>