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

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.