Welcome to WebmasterWorld Guest from

Forum Moderators: Ocean10000 & incrediBILL & phranque

Message Too Old, No Replies

help with htaccess

htaccess help



8:27 am on Dec 12, 2002 (gmt 0)

10+ Year Member

I've recently put up a anti-leech code for my site but for some reason, the code is also preventing my visitors from right clicking and saving files. Is there anyway I can modify the code to allow right clicking and still have it function as an anti-leech script from other server?

This is the code I'm using.
RewriteEngine On
RewriteCond %{HTTP_REFERER}!^$ [NC]
RewriteCond %{HTTP_REFERER}!^http://website.com/ [NC]
RewriteCond %{HTTP_REFERER}!^http://www.website.com/ [NC]
RewriteRule [^/]+.(jpeg¦jpg)$ - [F]


12:12 am on Dec 14, 2002 (gmt 0)

I use:

RewriteEngine on
RewriteCond %{HTTP_REFERER}!^$
RewriteCond %{HTTP_REFERER}!^http://domain.com/.*$ [NC]
RewriteCond %{HTTP_REFERER}!^http://www.domain.com/.*$ [NC]
RewriteRule .*\.(gif¦jpg)$ - [F]

users can still right click and download with out a problem

[edited by: DaveAtIFG at 12:50 am (utc) on Dec. 14, 2002]
[edit reason] Revised to generic URLs [/edit]


12:29 am on Dec 14, 2002 (gmt 0)

WebmasterWorld Senior Member jdmorgan is a WebmasterWorld Top Contributor of All Time 10+ Year Member

This is a little faster, covers more image file types and the periods in the URL are escaped properly:

RewriteEngine on
RewriteCond %{HTTP_REFERER}!^$
RewriteCond %{HTTP_REFERER}!^http://(www\.)?mydomain\.com [NC]
RewriteRule .*\.(gif¦jpg¦jpeg?¦png)$ - [F]

Note: Replace all broken vertical pipe symbols "¦" with the one from your keyboard before use!



Featured Threads

Hot Threads This Week

Hot Threads This Month