Currently, there is a product that supports iis urlrewrite. Its name is isapi_rewrite.
For my website, the anti-leech protection method is to add the following statement to httpd. ini:
Rewritecond host: (. +)
Rewritecond referer :(?! Http: // 1 .*).*
Rewriterule .*.(? : Gif | jpg | png | exe | rar | zip)/block.gif [I,
O]
Modify the httpd. ini file in the installation directory (if the file is "read-only", remove "read-only" and modify it again)
Add:
Rewritecond host: (. +)
Rewritecond referer :(?! Http: // 1 .*).*
Rewritecond referer :(?! Http: // (. *) (.baidu.com | .google.com | .google.cn | .g.cn | region | .soso.com | region | .youdao.com | .bing.com | .yahoo.com | .yahoo.cn | region )).*
Rewriterule .*.(? : Gif | jpg | jpeg | png | bmp)/block.gif [I, o, n]
Apache
To enable the image anti-leech function, add the following code to the htaccess file:
Rewriteengine on
Rewritecond % {http_referer }! ^ $
Rewritecond % {http_referer }! ^ Http: // (www .)? Allow1.com (/)?. * $ [Nc]
Rewritecond % {http_referer }! ^ Http: // (www .)? Allow2.com (/)?. * $ [Nc]
Rewriterule. *. (gif | jpg | jpeg | bmp | png) $ [r, nc, l]