Method One:
The commands you need are as follows:
Copy CodeThe code is as follows:
Rewriteengine on
Rewritecond%{Http_referer}!^$
Rewritecond%{http_referer}!^http://(www.)? Simue.com/.*$ [NC]
Rewriterule. (GIF &line;jpg) $-[F]
If you think it's nice to have a skylight on someone's page, you can use a picture instead:
View Code
Copy CodeThe code is as follows:
Rewriteengine on
Rewritecond%{Http_referer}!^$
Rewritecond%{http_referer}!^http://(www.) simue.com/.*$ [NC]
Rewriterule. (GIF &line;jpg) $ http://www.simue.com/Alternate picture file name [r,l]
It is important to note that if the created. Htaccess is uploaded to the server via FTP, the transfer mode should be ASCII rather than binary. After uploading to the server, its properties should be modified by chmod to 644 or "rw-r–r–", so that the server can be used at the same time cannot be modified through the browser, of course,. htaccess's readable properties also have a certain risk: An attacker can identify The object or authentication file location you want to protect-the solution is to put the authentication file. htpasswd to the root of the Web site so that it cannot be found on the network.
Method Two:
Copy CodeThe code is as follows:
View Code Rewriteengine on
Rewritecond%{http_referer}!^$ [NC]
Rewritecond%{http_referer}!simue.com [NC]
Rewritecond%{http_referer}!baidu.com [NC]
Rewritecond%{http_referer}!google.com [NC]
Rewriterule. *\. (gif|jpg) $ http://www.simue.com/no.png [r,nc,l]
simply explain the above statement:
1, Rewritecond%{http_referer}!^$ [NC]
Allow null "http_referer" access, that is, allows the user to enter the image address in the browser address bar directly when the picture file display. In general, this is optional, however, it is recommended that this setting, if forced to have "http_referer" to access, may cause some problems, such as when the user is accessed through a proxy server.
2, Rewritecond%{http_referer}!simue.com [NC]
Set the HTTP sources that are allowed to be accessed, including our website itself, Google, Baidu, and so on.
3, Rewriterule. *\. (gif|jpg|png) $ http://www.simue.com/no.png [r,nc,l]
Define the image to be substituted when hotlinking, let all hotlinking jpg, GIF, PNG and so on the webpage of file, display no.png file under root directory. Note: Replace the displayed picture without placing it in the directory where the anti-theft chain is set, and the smaller the picture file, the better. Of course, you can also not set a replacement image, but instead use the following statement:
Rewriterule. *\. (gif|jpg|png) $-[F]
4, explain the R, NC and L
R is the meaning of the turn
NC refers to case insensitive
The function of L is to indicate the end of this steering, and the subsequent steering is not affected by the previous judgment statement.
5. File types to prevent hotlinking
In the example above is a GIF, JPG, PNG, and as needed, you can change or add other file types, such as RAR, SWF, etc., using the "|" Between different file name extensions Segmentation.
http://www.bkjia.com/PHPjc/326960.html www.bkjia.com true http://www.bkjia.com/PHPjc/326960.html techarticle method One: The required command is as follows: The copy code code is as follows: Rewriteengine on Rewritecond%{http_referer}!^$ rewritecond%{Http_referer}!^http://(w ww.)? Simue.com/.*$ ...