Forum Moderators: phranque

Message Too Old, No Replies

.htaccess - stop hotlinking from databases

         

Hemeno

7:15 pm on Aug 9, 2007 (gmt 0)

10+ Year Member



Ok, I've tried a few .htaccess examples to prevent hotlinking, but none have worked. I've noticed that the files are being linked like this:

http://www.example.net/directory/album_pic.php?pic_id=123

So, this code:

RewriteEngine On

RewriteCond %{HTTP_REFERER} ^http://(.+\.)?myspace\.com/ [NC,OR]
RewriteCond %{HTTP_REFERER} ^http://(.+\.)?blogspot\.com/ [NC,OR]
RewriteCond %{HTTP_REFERER} ^http://(.+\.)?livejournal\.com/ [NC]
RewriteRule .*\.(jpe?g¦gif¦bmp¦png)$ - [F]

...doesn't work.

What do I need to do to block hotlinking in this situation? And is there a way I can block a few sites and not screw up my ranking/links/money from google images?

Thanks

phranque

7:31 pm on Aug 9, 2007 (gmt 0)

WebmasterWorld Administrator 10+ Year Member Top Contributors Of The Month



if you want to forbid any url referred from those domains, try:
RewriteRule .* - [F]

if you want to forbid any access to that particular script referred from those domains, try:

RewriteRule album_pic.php - [F]