Use.Htaccess to prevent images from being stolen

time:17-06-28 forum:PHP tools and code
  https://www.biaodianfu.com/htaccess-dis... Nking.html

specific operation, put.Htaccess files in the picture directory (the host appears not to support this function), content as follows / > >
[code]RewriteEngine on

RewriteCond%{HTTP_REFERER}! ^ $.#91; NC.#93;

RewriteCond%{HTTP_REFERER}! 91; NC.#93;

RewriteCond%{HTTP_REFERER}! Baidu.com.#91; NC.#93;

RewriteRule.

[code]RewriteCond%{HTTP_REFERER}! ^ $.#91; NC.#93;

RewriteCond%{HTTP_REFERER}! Biaodianfu.com.#91. />
RewriteCond%{HTTP_REFERER}! Baidu.com.#91; NC.#93; [/code]

this part of the code is to judge whether or not to steal the chain, that is, if the user is not directly input, not from Google or Baidu, the following turn is performed:

[code]RewriteRule. Gif.#91; R, NC, L.#93; [/code]

if the following formatting file (jpg, GIF, PNG, BMP, SWF, etc.) is stolen, all files are replaced with the pictures under the directory. (it is important to note that the images that are replaced are not placed in the directory of the chain of theft). If the above rules determine that the picture request is not a theft chain, the following turn is performed:

[code]RewriteRule ^ (. *) $http:\/\/image.biaodianfu.com\/image\/$1.#91; L.#93; [/code]

meaning is that all requests under the directory are turned to the target server, such as a picture original The URL is http://www.biaodianfu/img/logo.gif, now it will go to http://image.biaodianfu/image/logo.gif. Until now, you need to copy all the files from the original server img directory to the image directory of the picture server, so that the turn will be really available.

to prevent others from stealing chains, just change the file format.

the meaning of R, NC, and L under the name of the passing book: R refers to the turn, and NC refers to the case of no case. The function of L is to indicate the end of this turn, and the subsequent turn is not affected by the previous judgment statement.

also recommends a website for online generation of.Htaccess files to prevent chain theft: http://www.htmlbasix.com/disablehotlinking.shtml

prev:Shandong commercial housing warranty per... next:Using CURL instead of file_get_contents ...
post comment
Notice



approved   The girl wants to donate the liver t...   The most beautiful adoptive mother i...   What's the use and use of the social...   A glimpse of the Intangible Cultural...   The couple made tea by hand in deep ...
rand   PHP uses curl to simulate user landi...   MYSQL query optimization   PHP completely filters HTML, JS, CSS...   PHP extraction of Chinese characters...   Code to crack burglar chain by forgi...
ads

other

Because all the contents of this site are reproduced from other media, the intention is to provide free services to the public, but it does not mean that this site agrees with its views, and can not be responsible for the authenticity of its verification, such as the copyright unit or individual of the manuscript does not want to publish on this site, please Contact me, I will immediately remove it, thank you. Contact: atseashawk@163.com