homepage Welcome to WebmasterWorld Guest from
register, free tools, login, search, pro membership, help, library, announcements, recent posts, open posts,
Become a Pro Member

Visit PubCon.com
Home / Forums Index / Code, Content, and Presentation / Apache Web Server
Forum Library, Charter, Moderators: Ocean10000 & incrediBILL & phranque

Apache Web Server Forum

help with htaccess
htaccess help

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

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)

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!


Global Options:
 top home search open messages active posts  

Home / Forums Index / Code, Content, and Presentation / Apache Web Server
rss feed

All trademarks and copyrights held by respective owners. Member comments are owned by the poster.
Home ¦ Free Tools ¦ Terms of Service ¦ Privacy Policy ¦ Report Problem ¦ About ¦ Library ¦ Newsletter
WebmasterWorld is a Developer Shed Community owned by Jim Boykin.
© Webmaster World 1996-2014 all rights reserved