httpd-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Earl Terwilliger" <e...@micpc.com>
Subject [users@httpd] mod_rewrite
Date Mon, 12 Oct 2015 22:27:20 GMT
Hi,

I am a bit confused about the mod_rewrite documentation. It shows this
rule to block hotlinking:

RewriteCond "%{HTTP_REFERER}" "!^$"
RewriteCond "%{HTTP_REFERER}" "!www.example.com" [NC]
RewriteRule "\.(gif|jpg|png)$"    "-"   [F,NC]

however, I'd think a better rule would be:

RewriteCond "%{HTTP_REFERER}" "^$" [OR]
RewriteCond "%{HTTP_REFERER}" "!(www\.)?example.com/.*$" [OR,NC]
RewriteRule "\.(gif|jpg|png)$"    "-"   [F,NC]

if I want to block anyone manually typing in a link (no referer) +
hotlinking (probably has a referer). Do i need the [OR] on the 1st
RewriteCond and not the 2nd one? It seems to work with OR on both
conditions.

Thanks for any help!

Earl

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@httpd.apache.org
For additional commands, e-mail: users-help@httpd.apache.org


Mime
View raw message