Nov 25 2008

IIS 的免费 Rewrite 反盗链

Category: 技术ssmax @ 20:51:16

IIS有个免费的IIRF,rewriter,就像apache的mod_rewrite,基本上规则都一样,正则表达式是用pcre库,perl兼容的正则表达式,十分简单。

http://cheeso.members.winisp.net/IIRF.aspx

一个反盗链的例子

RewriteLogLevel 0

RewriteCond %{HTTP_REFERER} ^(?!HTTP_REFERER)
RewriteCond %{HTTP_REFERER} ^(?!https?://(?:.*\.)yourdomain\.com) [I]
RewriteRule ^.*$ /blocked.html [NF]

第一行的大概意思就是有REFERER头的请求才处理,NF就表示not found 404响应

Leave a Reply

*
To prove you're a person (not a spam script), type the security text shown in the picture. Click here to regenerate some new text.
Click to hear an audio file of the anti-spam word