Summary of WordPress Image anti-Leech protection methods

Source: Internet
Author: User
Tags wordpress blog

Anti-image leeching by modifying the. htaccess file under the root directory of the host

WordPress blogs generally use Linux hosts, so you can use FTP to access the root directory of the website and find the. htaccess file. Add:

The code is as follows: Copy code

1. # BEGIN WordPress
2. <IfModule mod_rewrite.c>
3. RewriteEngine On
4. RewriteBase/
5. RewriteRule ^ index. php $-[L]
6. RewriteCond % {REQUEST_FILENAME }! -F
7. RewriteCond % {REQUEST_FILENAME }! -D
8. RewriteRule./index. php [L]
9. </IfModule>
10. # END WordPress


If you want other websites to use your images, you can

The code is as follows: Copy code

RewriteCond % {HTTP_REFERER }! Add
RewriteCond % {HTTP_REFERER }! You need to display the URL [NC]

Generally, you can add FEED subscription URLs, Baidu, Google, Yahoo, and Souso.

The code is as follows: Copy code


1. # BEGIN WordPress
2. <IfModule mod_rewrite.c>
3. RewriteEngine On
4. RewriteBase/
5. RewriteCond % {REQUEST_FILENAME }! -F
6. RewriteCond % {REQUEST_FILENAME }! -D
7. RewriteRule./index. php [L]
8. RewriteBase/wp-content/uploads/
9. RewriteCond % {HTTP_REFERER }! ^ $ [NC]
14. RewriteCond % {HTTP_REFERER }! Google.com [NC]
17. RewriteCond % {HTTP_REFERER }! Baidu.com [NC]
18. RewriteRule. *. (gif | jpg | png | rar) $ yun_qi_img/96.png [L] 19. </IfModule>
20. # END WordPress

In the final example, the stealing.png file is used to replace the image with a leeching Image. We recommend that you use the smaller image, the better. You can get a big red cross and write it down to reject leeching.

Friendly reminder: it is not recommended to Disable gif | jpg | pngat the same time. If you have already disabled png, but stealing.png is used to replace the leeching image, the problem will certainly occur. If you want to disable these three types at the same time, you can replace them with the following sentence:

RewriteRule. (gif | png | jpg) $ absolute image address (http: // required) [R, NC, L]

OK. Image anti-Leech using the. htaccess file has been completed. Similarly, you can not only set anti-Leech protection for images, but also add File extensions to set anti-Leech protection for other files.

Note: overwrite the modified. htaccess file to the original space file and set the permission to 444 read-only, which can prevent the setting program from being replaced automatically.


Other methods


Add watermarks to images

In this way, you can add a URL as a watermark so that when the uploader displays the content, the website will also be displayed. Although anti-leeching is not achieved, it can play a role in promotion.

 
Simply not put images in the wordpress blog host

In our tutorial, we recommend that you use images of external links, such as albums of external links.


Use Hotlink protection plug-in

Download the Hotlink protection plug-in. After installing the plug-in, you can go to the plug-in settings page.

You can set the path to protect images in the background of this plug-in, such as wp-content/uploads, the warning image on the right is used to replace the original image on the web page of leeching. Of course, the warning image can also be set in the background of the plug-in.

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.