Why isnt my .htaccess image hot-linking block not working?

113 Views Asked by At

I have tried several things to BLOCK images that are hosted on my site in a particular website/forum, and redirect to a different image of choice.

The only results I seem to get are:

  • images blocked on ALL site
  • images re-directed to correct re-direct image on 3rd party site..... but -ALSO- on my domain too?

I have included my FULL .htaccess (as I have a handful of other entries in there for re-directing to SSL, and well as a sub-domain used for developing a new site) as I'm un-sure if any previous entries might be messing things up? (although I dont think so) :)

RewriteEngine On

#SSL Stuff
RewriteCond %{HTTP_HOST} ^mydomain\.net$ 
RewriteRule ^(.*)$ http://www. mydomain.net/$1 [R=301]

#SSL Stuff
RewriteCond %{HTTPS} off
RewriteCond %{HTTP_HOST} ^www\.mydomain\.net$
RewriteRule ^(.*)$ https://www. mydomain.net/$1 [R=301,L]

#new dev site
#RewriteCond %{HTTP_HOST} !^staging.mydomain\.net$ [NC]
#RewriteRule (.*) http://staging.mydomain.net/$1 [R=301,L] 


# ---- [do not touch above] ----


#RewriteCond %{HTTP_REFERER} !^$
RewriteCond  %{HTTP_REFERER}  !^http(s)://(www\.)?mydomain\.net(/)?.*$  [NC]
RewriteCond %{HTTP_REFERER} ^http(s)://(www\.)?3rd-party-hot-linker.com(/.*)*$ [NC,OR]
RewriteRule .*\.(gif|jpg|jpeg|bmp|png)$ http://www.some-other-domain/image.jpg [R,NC]

I have attempted to use the above.. as well as some variants:

#RewriteCond  %{HTTP_REFERER}  !^http(s)://(www\.)?mydomain\.net(/)?.*$  [NC]
RewriteCond %{HTTP_REFERER} ^http(s)://(www\.)?3rd-party-hot-linker.com(/.*)*$ [NC,OR]
RewriteRule .*\.(gif|jpg|jpeg|bmp|png)$ http://www.some-other-domain/image.jpg [R,NC]



RewriteCond  %{HTTP_REFERER}  !^http(s)://(www\.)?mydomain\.net(/)?.*$  [NC]
#RewriteCond %{HTTP_REFERER} ^http(s)://(www\.)?3rd-party-hot-linker.com(/.*)*$ [NC,OR]
RewriteRule .*\.(gif|jpg|jpeg|bmp|png)$ http://www.some-other-domain/image.jpg [R,NC]



#RewriteCond %{HTTP_REFERER} !^http://(www\.)?mydomain\.net(/)?.*$  [NC]
#RewriteCond %{HTTP_REFERER} !^https://(www\.)?mydomain\.net(/)?.*$  [NC]
#RewriteCond %{HTTP_REFERER} ^http://(www\.)?3rd-party-hot-linker.com(/.*)*$ [NC,OR]
#RewriteCond %{HTTP_REFERER} ^https://(www\.)?3rd-party-hot-linker.com(/.*)*$ [NC,OR]

And I just cant NOT seem to get the results I am looking for!!?? I'm not sure if I'm doing something wrong? Fighting with my browser cache? or what..

Basically ANY image requests from that 3rd party forum, that have links to images hosted on mydomain.. I want to re-direct to a different image. (thats it!)..

I dont want it to affect MY domain/site and using its images.. an no matter I have tried, I keep getting mixed results on my site.. and never the redirect image on the 3rd party site!?

  • I was even see some images on mydomain being replaced..and -some- not? (even though all were .jpg and located in same directory on mydomain?)

Completely lost here....?

0

There are 0 best solutions below