Effective solution to prevent leeching in Apache

Source: Internet
Author: User
Article title: Apache's effective solution to prevent leeching. Linux is a technology channel of the IT lab in China. Includes basic categories such as desktop applications, Linux system management, kernel research, embedded systems, and open source.
First, open the. htaccess file under the root directory of your website and write the following data:
The following is an example of using PCZONE. replace it with your own website address (if you are not a real host and do not have your own fixed IP address, you do not need to set hosts for the IP address data in the following 3rd columns)
  
SetEnvIfNoCase Referer "^ http: // www \. pczone \. com \. tw/" local_ref = 1
SetEnvIfNoCase Referer "^ http: // pczone \. com \. tw/" local_ref = 1
SetEnvIfNoCase Referer "^ http: // 202 \. 43 \. 85 \. 163/" local_ref = 1
   <-- Set it as needed
Order Allow, Deny
Allow from env = local_ref
Allow from 127.0.0.1
  
  
After you write the file in this way, place the file to the root directory of the website and then OK the file on your website (any file configured on it, such as TXT, DOC ...) only accessible from the site. if someone is from another website, because the source IP address is not inside the 127.0.0.1 host you allow, therefore, the files, images, and MP3 files you set in your host space will not be stolen ....
  
As long as it is the file you requested by the above steps, whether it is a GIF file, audio and video files, compressed files, programs .. or some others do not .. as long as you are in. htaccess has been set to all, all have the effect of preventing unauthorized connection so that your host bandwidth will not be occupied by others or get the traffic to break the table and the host company will get the debt
  
As long as you set it, visitors cannot directly steal the connection (unless you use software to capture the website, but this should be called "download" website archives ..). the word "htaccess" is already a complete file name. it does not have an extension. do not add it by yourself. number indicates the meaning of a hidden file!
  
New return from websites' friends: WIN + APACHE can use the above method to prevent unauthorized connections
  
  
Someone asked, what should I do if I want to open some platforms to directly link the data on my website?
  
For example, if you want to open the pasters on the pczone.com.tw website, you can directly use them from your website. add the following three lines to the. htaccess file:
  
(The following settings mean that, except for your own website and the PCZONE website, other websites still cannot steal data from your website)
  
SetEnvIfNoCase Referer "^ http: // www \. pczone \. com \. tw/" local_ref = 1
SetEnvIfNoCase Referer "^ http: // pczone \. com \. tw/" local_ref = 1
SetEnvIfNoCase Referer "^ http: // old information of your website/" local_ref =
    
Order Allow, Deny
Allow from env = local_ref
Allow from 127.0.0.1
Allow from 202.43.85.163 <-this IP address is a fixed IP address of the PCZONE website and must be entered!
  
Related Article

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.