Forum Moderators: phranque

Message Too Old, No Replies

stop only one site from hotlinking

stop only one site from hotlinking

         

StopSpam

3:09 pm on May 5, 2003 (gmt 0)

10+ Year Member



Is there a qucik .htaccess code way
to prevent one site from hotlinking my images.

just one domain?

i got this code but it wil block all sites ececpt from sites i added....

RewriteCond %{HTTP_REFERER}!^$
RewriteCond %{HTTP_REFERER}!^http://(www\.)?YourSiteName\.com/ [NC]
RewriteRule .*\.(gif¦GIF¦jpg¦JPG)$ [YourSiteName.com...] [R]

i want code the works the other way around ...
if i add domain then it can that domain name can not hotlink
is this posible as i only want to block one site

please post sample code

Thanks

BCMG_Scott

7:02 pm on May 5, 2003 (gmt 0)

10+ Year Member



Should be this:

RewriteCond %{HTTP_REFERER}^http://(www\.)?BlockedSiteName\.com/ [NC]
RewriteRule .*\.(gif¦GIF¦jpg¦JPG)$ [YourSiteName.com...] [R]

If my mod_rewrite rules/conds serves me correct.

Scott

StopSpam

7:26 pm on May 5, 2003 (gmt 0)

10+ Year Member



Hi Scott thanks for reply ..

are you sure?

i see no differance between the code?

jdMorgan

8:05 pm on May 5, 2003 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



If you want to block "BlockedSiteName.com" instead of serving an alternate image, try this:

RewriteCond %{HTTP_REFERER} ^http://(www\.)?BlockedSiteName\.com/ [NC]
RewriteRule \.(gif¦jpg)$ - [NC,F]

Note that the "¦" must be edited - Use the solid vertical pipe character from your keyboard.
Use of the [NC] flag makes the pattern test case-insensitive, and eliminates the need for both upper and lowercase patterns.

Reference: Introduction to mod_rewrite [webmasterworld.com]

Jim

StopSpam

8:25 pm on May 5, 2003 (gmt 0)

10+ Year Member



Thanks