Forum Moderators: phranque
RewriteEngine on
RewriteCond %{HTTP_REFERER}!^$
RewriteCond %{HTTP_REFERER}!^http://(www\.)?example.com/.*$ [NC]
RewriteRule \.(gif¦jpg)$ http://www.example.com/dontsteal.gif [R,L]
to run on Zeus?
[edited by: encyclo at 1:40 am (utc) on July 16, 2008]
[edit reason] examplified [/edit]
RewriteEngine on
RewriteCond %{HTTP_REFERER}!^$
RewriteCond %{HTTP_REFERER}!^http://(www\.)?photos.example.com/.*$ [NC]
RewriteRule \.(gif¦jpg)$ - [F]
with
RULE_0_START:
match URL into $ with \.(gif¦jpg)$
if not matched then goto RULE_0_END
# Source line 2
# RewriteCond %{HTTP_REFERER}!^$
set SCRATCH:COND = %{IN:Referer}
match SCRATCH:COND into % with ^$
if matched then goto RULE_0_END
# Source line 3
# RewriteCond %{HTTP_REFERER}!^http://(www\.)?photos.example.com/.*$ [NC]
set SCRATCH:COND = %{IN:Referer}
insensitive match SCRATCH:COND into % with ^http://(www\.)?photos.example.com/.*$
if matched then goto RULE_0_END
# Source line 4
# Second half of: RewriteRule \.(gif¦jpg)$ - [F]
# This rule has [F]
set RESPONSE = 403
set BODY = Access to this page is denied
# Implicit [L] when converting
goto END
RULE_0_END:
or (and this is the one I'd prefer to use as it replaces the hotlinked image with a small gif) replaces
RewriteEngine on
RewriteCond %{HTTP_REFERER}!^$
RewriteCond %{HTTP_REFERER}!^http://(www\.)?photos.example.com/.*$ [NC]
RewriteRule \.(gif¦jpg)$ [photos.example.com.gif...] [R,L]
with
RULE_0_START:
match URL into $ with \.(gif¦jpg)$
if not matched then goto RULE_0_END
# Source line 2
# RewriteCond %{HTTP_REFERER}!^$
set SCRATCH:COND =
match SCRATCH:COND into % with
if not matched then goto RULE_0_END
# Source line 3
# RewriteCond %{HTTP_REFERER}!^http://(www\.)?photos.example.com/.*$ [NC]
set SCRATCH:COND = %{IN:Referer}!^http://(www\.)?photos.example.com/.*$
match SCRATCH:COND into % with [NC]
if not matched then goto RULE_0_END
# Source line 4
# Second half of: RewriteRule \.(gif¦jpg)$ [photos.example.com...] [R,L]
set URL = [photos.example.com...]
# This rule has [R]
set RESPONSE = 302
set OUT:Location = %{URL}
set BODY = Please try <a href="%{URL}">here</a> instead\n
# Implicit [L] when converting
goto END
RULE_0_END:
but neither of these work. can anyone please help?
[edited by: encyclo at 1:43 am (utc) on July 16, 2008]
[edit reason] examplified [/edit]