Forum Moderators: bakedjake

Message Too Old, No Replies

Blocking hotlinkers with .htaccess

Not everyone, just one, specific site

         

Marauder

8:28 am on Jul 3, 2003 (gmt 0)

10+ Year Member



I was wondering if anyone knew if and how it was posibble to block a specific site from hotlinking images. Thanks to the wonders of scriptings, I can easily view who is hotlinking. I don't stop all hotlinking because I don't mind viewers using them on their forum signatures and icons, nor do I mind them putting them on their personal profiles. What I do have a problem with, however, is one site that has pasted all of these images without any permission. I'm still rather new to the whole Unix world, so I was wondering how I could do it in .htaccess if it were possible and if you could provide examples.

Thank you.

takagi

10:22 am on Jul 3, 2003 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Try the example at Preventing hotlinking to images [webmasterworld.com]. People with a personal firewall like Norton will still see the images, but others will not.

Marauder

2:39 am on Jul 4, 2003 (gmt 0)

10+ Year Member



Hmm, that's not exactly what I was looking for. I know how to do that, but I don't know how to block a specific referrer.

jdMorgan

4:59 am on Jul 4, 2003 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Marauder,

Welcome to WebmasterWorld [webmasterworld.com]!

Something to get you started:


Options +FollowSymLinks
RewriteEngine on
RewriteCond %{HTTP_REFERER} ^http://(www\.)?baddomain\.com [NC]
RewriteRule \.(jpe?g¦gif)$ - [NC,F]

You will need to edit the "¦" character, and change it back to a solid vertical pipe - otherwise, you'll get a server error.

Ref: Introduction to mod_rewrite [webmasterworld.com]

Jim