Forum Moderators: phranque
##################################################################
# to allow certain white-hat parties through the hotlink
# protection
##################################################################
RewriteCond %{HTTP_REFERER} !^$
RewriteCond %{HTTP_REFERER} !^111\.222\.333\.444.*$ [NC]
RewriteCond %{HTTP_REFERER} !^www.good_domain.com/.*$ [NC]
...etc...
RewriteRule .*\.(jpg|gif)$ /hotlink.png [R,NC]
################################################################## ##################################################################
# to block scraper using Amazon 'viewfoo' service
##################################################################
RewriteCond %{HTTP_REFERER} ^viewfoo\.com/.*$ [NC,OR]
RewriteCond %{HTTP_REFERER} ^54\.67\.49\.123.*$ [NC]
RewriteRule .*\.(jpg|gif)$ /hotlink.png [R,NC]
################################################################## <div class="box-content document_holde ajbox_content textEditor" id="box_count_0" style="stuff...">
[mytext mytext mytext mytext...]
<img src="http://www.example.com/images/filename1.gif">
[mytext mytext mytext mytext...]
<ins id="aswift_0_expand" style="stuff...">
<ins id="aswift_0_anchor" style="stuff..">
<iframe name="aswift_0" width="300" height="250" id="aswift_0" frameborder="0" marginwidth="0" marginheight="0" scrolling="no" vspace="0" hspace="0" allowfullscreen="true" style="left: 0px; top: 0px; position: absolute;" allowtransparency="true">
</iframe>
</ins>
</ins>
[mytext mytext mytext mytext...]
<img src="http://www.example.com/images/filename2.gif">
[mytext mytext mytext mytext...]
</div> [edited by: Ocean10000 at 8:15 pm (utc) on Jun 4, 2015]
[edit reason] examplfied. [/edit]
RewriteCond %{HTTP_REFERER} !^www.good_domain.com/.*$ [NC]
RewriteCond %{HTTP_REFERER} !www\.good-domain\.com
RewriteCond %{HTTP_REFERER} ^54\.67\.49\.123.*$ [NC]
RewriteCond %{REMOTE_ADDR} =54.67.49.123 Header append X-FRAME-OPTIONS "SAMEORIGIN" not2easy said:
If your content is being shown in an iframe then .htaccess hotlink protection is bypassed because the images are being called from your own site.
whitespace said:
Something not quite right, as your first block should be blocking.
not2easy said:You can append headers that specify "SAMEORIGIN" by adding this to your .htaccess file:
Header append X-FRAME-OPTIONS "SAMEORIGIN"
whitespace said:
An iframe breakout javascript is another alternative....
lucy24 said:
Under what circumstances would a referer ever come through as a numerical IP instead of a hostname?