首先是要安装伪静态模块,具体安装方法另行百度搜索.
安装完后,在网站根目录的web.config文件填入下面代码即可.
白名单一行不够可以复制一行,表示只允许www.orsoon.com.com的来源才显示jpg,gif资源.
<?xml version='1.0' encoding='UTF-8'?> <configuration> <system.webServer> <rewrite> <rules> <rule name='Prevent hotlinking'> <match url='^.*.(jpg|gif)$' ignoreCase='true' /> <conditions> <add input='{HTTP_REFERER}' pattern='http://www.orsoon.com/.*' negate='true' /> </conditions> <action type='Rewrite' url='/img/logo.png' /> </rule> </rules> </rewrite> </system.webServer> </configuration>