Forum Moderators: phranque
I'm assuming that due to a provider caching the page, prior to handing it to the user, the request for the images on the page does not actually come from my domain it comes from the provider and therefore the user sees no images...because actually they are hotlinking in a certain respect...
It only happens with a couple of providers, and I'm wondering how much business I'm losing because of it..
(am I clear about this issue?)
is there any workaround other than changing my htaccess to allow hotlinking (Not my first choice at all)
if I haven't explained the issue enough, I'll be happy to try again...
Thanks!
Tera
(some background...)
I have 1 subdomain I use for customers
and 2 domains pointing to the site
thanks in advance!
=======================
order allow,deny
allow from all
RewriteEngine on
RewriteCond %{HTTP_REFERER}!^http://subdomain.domain1.com/.*$ [NC]
RewriteCond %{HTTP_REFERER}!^http://subdomain.domain1.com$ [NC]
RewriteCond %{HTTP_REFERER}!^http://domain1.com/.*$ [NC]
RewriteCond %{HTTP_REFERER}!^http://domain1.com$ [NC]
RewriteCond %{HTTP_REFERER}!^http://domain2.net/.*$ [NC]
RewriteCond %{HTTP_REFERER}!^http://domain2.net$ [NC]
RewriteCond %{HTTP_REFERER}!^http://www.domain1.com/.*$ [NC]
RewriteCond %{HTTP_REFERER}!^http://www.domain1.com$ [NC]
RewriteCond %{HTTP_REFERER}!^http://www.domain2.net/.*$ [NC]
RewriteCond %{HTTP_REFERER}!^http://www.domain2.net$ [NC]
RewriteRule .*\.(jpg¦jpeg¦gif¦png¦bmp)$ - [F,NC]
RewriteEngine On
RewriteBase /
RewriteCond %{HTTP_HOST} ^domain1\.com
RewriteRule (.*) [domain1.com...] [R=301,L]
RewriteEngine On
RewriteBase /
RewriteCond %{HTTP_HOST} ^domain2\.net
RewriteRule (.*) [domain1.com...] [R=301,L]
RewriteEngine On
RewriteBase /
RewriteCond %{HTTP_HOST} ^www.domain2\.net
RewriteRule (.*) [domain1.com...] [R=301,L]
Order Allow,Deny
Allow from all
#
RewriteEngine on
RewriteBase /
#
# Block image access (hotlinking) if off-site referrer is present in the request
RewriteCond %{HTTP_REFERER} .
RewriteCond %{HTTP_REFERER} !^http://subdomain\.domain1.com [NC]
RewriteCond %{HTTP_REFERER} !^http://(www\.)?domain1\.com [NC]
RewriteCond %{HTTP_REFERER} !^http://(www\.)?domain2\.net [NC]
RewriteRule \.(jpe?g¦gif¦png¦bmp)$ - [F,NC]
#
# Redirect non-www domain1.com to www.domain1.com
RewriteCond %{HTTP_HOST} ^domain1\.com
RewriteRule (.*) http://www.domain1.com/$1 [R=301,L]
#
# Redirect www or non-www domain2.net to www.domain1.com
RewriteCond %{HTTP_HOST} ^(www\.)?domain2\.net
RewriteRule (.*) http://www.domain1.com/$1 [R=301,L]
The new RewriteCond requires that the HTTP_REFERER request header be non-blank before the other RewriteConds are evaluated and the RewriteRule can be applied.
Allowing blank referrers will allow some hotlinking to occur, but the choice is between that and blocking legitimate users. The presence of the HTTP_REFERER in even legitimate requests simply cannot be relied upon.
Replace the broken pipe "¦" characters above with solid pipe characters before use; Posting on this forum modifies the pipe characters.
If you intend to use cPanel to add and remove access restrictions in the future, I cannot recommend hand-editing the .htaccess file to use this code. If you do this, and then later use cPanel to make further modifications, the result may be a big mess, and it will likely not work. So the choices are either to commit to a hand-edited .htaccess file (and all the research/learning that entails) or to try to use cPanel to include the "Allow blank referrers" option if it is supported. Because of the awful code that cPanel produces (because it using a basic "template" to generate the code), I have long ago given up on cPanel for .htaccess maintenance. But you'll have to make this choice for yourself, because what's important to my sites (performance over convenience) may be less important to yours.
For more information, see the documents cited in our forum charter [webmasterworld.com] and the tutorials in the Apache forum section of the WebmasterWorld library [webmasterworld.com].
Jim