httpd-users mailing list archives

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

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

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

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

RewriteCond "%{HTTP_REFERER}" "^$" [OR]
RewriteCond "%{HTTP_REFERER}" "!(www\.)?*$" [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

Thanks for any help!


To unsubscribe, e-mail:
For additional commands, e-mail:

View raw message