Start of Part Two...
Notes: you can also change one of the “RewriteRule” to forbid users from stealing your images and bandwidth.
—Copy Source Code—
Code:
RewriteRule \.(jpeg|jpg|gif|png|mp3|zip|rar)$ /images/nohotlink.jpe [L]
RewriteRule \.(jpeg|jpg|gif|png|mp3|zip|rar)$ - [F]
—End Source Code—
To block Search engines, you can use this instead…
Notes: it will not block all of the search engines. This example will only block yahoo, google and askjeeves.
—Copy Source Code—
Code:
RewriteEngine on
RewriteCond %{HTTP_REFERER} ^http(s)?://(www\.)?google.com [NC,OR]
RewriteCond %{HTTP_REFERER} ^http(s)?://(www\.)?yahoo.com [NC,OR]
RewriteCond %{HTTP_REFERER} ^http(s)?://(www\.)?askjeeves.com [NC]
RewriteRule \.(jpg|jpeg|png|gif|zip)$ - [NC,F,L]
—End Source Code—
Copyright 2001-2008 Lair360
This is another alternative, you can also use this source code…if you desire…
Allowing multiple sites and block all other sites.
—Copy Source Code—
Code:
RewriteEngine On
RewriteCond %{HTTP_REFERER} !^http://(.+\.)?you\.com/ [NC]
RewriteCond %{HTTP_REFERER} !^http://(.+\.)?ok1\.com/ [NC]
RewriteCond %{HTTP_REFERER} !^http://(.+\.)?ok2\.com/ [NC]
RewriteCond %{HTTP_REFERER} !^$
RewriteRule .*\.(jpg|jpeg|gif|bmp|png|swf)$ - [F]
—End Source Code—
Allowing one site and block all other sites.
—Copy Source Code—
Code:
RewriteEngine On
RewriteCond %{HTTP_REFERER} !^http://(.+\.)?you\.com/ [NC]
RewriteCond %{HTTP_REFERER} !^$
RewriteRule .*\.(jpg|jpeg|gif|bmp|png|swf)$ - [F]
—End Source Code—
Here is the bonus and it also works!
—Copy Source Code—
Code:
RewriteEngine On
RewriteCond %{HTTP_REFERER} !^$
RewriteCond %{HTTP_REFERER} !^http://(.*\.)?lair360.srhost.info [NC]
RewriteCond %{HTTP_REFERER} !^http://(.*\.)?lair360.wordpress.com [NC]
RewriteCond %{HTTP_REFERER} !^http://(.*\.)?stonerocket.net [NC]
RewriteRule .*\.(jpg|jpeg|png|gif|zip|rar)$ - [F]
—End Source Code—
As I’ve said this before, you can use this code below instead of using the [F] command.
—Copy Source Code—
Code:
RewriteRule .*\.(jpeg|jpg|gif|png|mp3|zip|rar)$ /images/nohotlink.jpe [L]
RewriteRule .*\.(jpeg|jpg|gif|png|mp3|zip|rar)$ - [F]
—End Source Code—
This source code will only block some outside url and not all of them. But, this source is only use for advance users!
—Copy Source Code—
Code:
RewriteEngine On
RewriteCond %{HTTP_REFERER} ^http://([a-z0-9]+\.)?domain1.com(/)?.*$ [NC,OR]
RewriteCond %{HTTP_REFERER} ^http://([a-z0-9]+\.)?domain2.com(/)?.*$ [NC,OR]
RewriteCond %{HTTP_REFERER} ^http://([a-z0-9]+\.)?domain3.com(/)?.*$ [NC]
RewriteRule .*\.(gif|jpg|png)$ - [F]
—End Source Code—
This is also an alternative with an option to allow “Symlink”.
But, if you want to use this option, you’ll need to remove one of the special character from the second line.
—Copy Source Code—
Code:
RewriteEngine on
# Options +FollowSymlinks
RewriteCond %{HTTP_REFERER} !^$
RewriteCond %{HTTP_REFERER} !^http://(www\.)?yourdomain1.com/.*$ [NC]
RewriteCond %{HTTP_REFERER} !^http://(www\.)?yourotherdomain2.com/.*$ [NC]
RewriteCond %{HTTP_REFERER} !^http://(www\.)?yourotherdomain3.com/.*$ [NC]
RewriteRule \.(gif|jpg|jpeg|jpg|png|js|css)$ - [F]
—End Source Code—
Copyrighted by Lair360