Implementation of IIS Picture Anti-Theft chain method based on ISAPI rewrite software _win server

Source: Internet
Author: User
Tags rar
The following operation, may cause the user's disgust, if the visitor wants to from you this page, saves a picture to be unable, the user experience what AH.

Implementation steps:
1. Download a free version of the ISAPI rewrite software provided by the more famous www.helicontech.com (although there are some functional limitations on the free version, it is sufficient to do the anti-theft chain):
Http://www.isapirewrite.com/download/isapi_rwl_x86_0072.msi
2. Set the Software installation directory of the IIS_WGP group read and Write permissions (important, if not set up after the installation of your site will be directly service unavailable, inaccessible).
To set the method:
If your installation directory is D:program filesheliconisapi_rewrite (the default installation directory is program Filesheliconisapi_rewrite, we can build it first), right click Isapi_rewrite, Select the "Properties"-> "Security"-> "Add"-> "advanced"-> "Find Now" to find a IIS_WGP, double-click Add, OK. Then select the Group and click "Full Control" to have read and write access.
3. Install the software (the software will restart IIS during the installation process). Install directory Select the directory that has the right permissions in the previous step, open the Internet Information Service in the Control Panel after the installation, and open the Properties dialog box of the Web site with an "ISAPI filter", click "Add", "Filter Name" Casually fill out a good understanding of the name can be, "executable" Item click "Browse", select just installed the Isapi_rewrite installation directory of Isapi_rewrite.dll, OK. Restart IIS.
4. Modify the Httpd.ini file in the installation directory (if this file is read only), remove "Read Only" and then modify it.
Add to:
Copy Code code as follows:

Rewritecond Host: ^ (. +) $
Rewritecond Referer: ^ (?!) http://\1.*). *$
Rewritecond Referer: ^ (?!) Http://.*.baidu.com|. *.google.com|. *googlebot.com|. *.jb51.net). *). *$
Rewriterule ^ (?!) (/logo.gif|/2_files/logo_tg.gif)). *. (?: gif|jpg|jpeg|png) $/block.gif [I,o,n]

EXPLANATION Note:
A. The www.jb51.net in the third line of the above rules for your site's domain name, please make corresponding changes according to the actual situation, inside the baidu.com and google.com is to not prevent search engine spiders crawl pictures.
B. Line fourth in the/logo.gif and 2_fies/logo_tg.gif for your logo image address, the purpose is to allow others to use your logo, if you do not need to be able to remove "(?!) (/logo.gif|/2_files/logo_tg.gif)) ". Later gif jpg and so on can be modified according to the actual situation.
Modifying the rule without restarting IIS requires only modifying the Httpd.ini configuration file.

The following are the relevant articles of other netizens

The use of Isapi_rewrite can be similar to Apache pseudo static path, using its check refer function we can also implement anti-theft chain. The software can be downloaded in http://www.helicontech.com/download/, is a shareware, but there is a lite version is free, basically can achieve the function we need. Installation of the steps I do not say in detail, specifically said Httpd.ini settings.
First, you must ensure that the Httpd.ini has writable permissions and that the Isapi_rewrite installation folder Everyone has modifiable permissions to remove the read-only property of the file.
Httpd.ini default settings are as follows:
Rewritecond Host: (. +)
Rewritecond Referer: (?!) http://\\1.*). *
We'll add a sentence behind it.
Rewriterule. *\\. (?: gif|jpg|png|exe|rar|zip)/block.gif [I,o]
Can realize Gif/jpg/png/exe/rar/zip file anti-theft chain, hotlinking page shows is/block.gif. Block.gif is a small picture file, we can play on the top of their own website copyright logo and anti-theft chain statement.
If you follow the above settings, then all sites except this site can not use the picture here, if you want to allow a number of exceptions to the site such as Google,baidu and other non-profit site references to do? We can use the following regular expressions to implement
Rewritecond Referer: (?!) http://(?: www\\.liehuo\\.net|www\\.google\\.com|www\\.baidu\\.com)). +
If you want to allow all Google and Baidu sub-station such as Images.baidu.com,images.google.com station to do the following settings:
Rewritecond Referer: (?!) http://(?:* \\.liehuo\\.net|*\\.google\\.com|*\\.baidu\\.com)). +
At this point, a fairly effective anti-theft chain system has come out, but if the setting has a problem, if the browser browsing the Hotlinking page after the visit to the Site page, the hotlinking image of the cache will affect the normal display of pictures. Put
Rewriterule. *\\. (?: gif|jpg|png|exe|rar|zip)/block.gif [I,o]
To
Rewriterule. *\\. (?: gif|jpg|png|exe|rar|zip)/block.gif [I,o,n]
Side can. Parameter n means to request the file again from the site instead of the local cache read.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.