If apache does not support. htaccess, perform the following operations:
Open the httpd. conf file in a text editor and find
| The code is as follows: |
Copy code |
Options FollowSymLinks AllowOverride None
Changed: Options FollowSymLinks AllowOverride All |
However, I did not find Options FollowSymLinks or other things in my httpd. conf file. I have
| The code is as follows: |
Copy code |
Options FollowSymLinks AllowOverride All
|
Manually add it to the httpd. conf file and restart the Apache server.
Now let's configure anti-Leech. Create a. htaccess file in the root directory of your website and add the following code to the page:
| The code is as follows: |
Copy code |
RewriteEngine On RewriteCond % {HTTP_REFERER }! ^ $ [NC] RewriteCond % {HTTP_REFERER }! Phpddt.com [NC] RewriteCond % {HTTP_REFERER }! Google.com [NC] RewriteCond % {HTTP_REFERER }! Baidu.com.com [NC] RewriteCond % {HTTP_REFERER }! Feedburner.com [NC] RewriteCond % {HTTP_REFERER }! Feedsky.com [NC] RewriteRule. *. (rar | zip) $ http://www.111cn.net/[R, NC, L]
|
The above code is also easy to understand:
| The code is as follows: |
Copy code |
RewriteCond % {HTTP_REFERER }! ^ $ [NC]
|
An empty source is allowed, that is, if the user's browser manually belongs to the source, files can be accessed.
| The code is as follows: |
Copy code |
RewriteCond % {HTTP_REFERER }! Phpddt.com [NC]
|
Allow access to the site itself. Similarly, access to Baidu, Google, and some subscription sources will be allowed later.
| The code is as follows: |
Copy code |
RewriteRule. *. (rar | zip) $ http://www.111cn.net/[R, NC, L]
|
Here, you can set the anti-Leech protection type. If you can jump to the homepage of a website, there is no anti-Leech protection for images on this site. If you do an anti-Leech protection for images, you can set an alternative image for the leeching:
| The code is as follows: |
Copy code |
| RewriteRule. *. (gif | jpg | png) $ http:/www.111cn.net/logo.png [R, NC, L] |