Jump to content

[htaccess] hotlink protection and http referer redirect not working together.


Recommended Posts

I have a little issue with two different re-writes. I have a few sites I want to redirect the referers from. But I also wanted to hotlink the same sites from linking to images.

 

I allowed the sites addons and primary domains to hotlink to images. But when I added a new condition and rule to redirect the referers it also added them to the allowed hotlinks.

 

I have not figured out how to break the two different re-writes. Looking at it I can see why it would add them. Tried to put one before the other with no change.

 

It does redirect the referers but it will not stop them from hot linking. Hot links I used cpanel to write to hatacces. The redirects I googled and altered till it worked with server.

 

PHP Version 5.2.17

 

Could someone point me in the right direction.

 

RewriteEngine on

RewriteCond %{HTTP_USER_AGENT} ^MaMa\ CaSpEr [NC,OR]
RewriteCond %{HTTP_USER_AGENT} ^MaMa\ CyBer [NC,OR] 
RewriteCond %{HTTP_USER_AGENT} ^ScoutJet* [NC,OR]
RewriteCond %{HTTP_USER_AGENT} ^YandexBot* [NC,OR]
RewriteCond %{HTTP_USER_AGENT} ^Baiduspider* [NC,OR]
RewriteCond %{HTTP_USER_AGENT} ^Sosospider* [NC,OR]
RewriteCond %{HTTP_USER_AGENT} ^Mozilla/4\.76\ \[ru]\ \(X11;\ U;\ SunOS\?\ 5\.7\ sun4u\) [NC,OR]
RewriteCond %{HTTP_USER_AGENT} ^ZmEu*
RewriteRule .* - [F]

RewriteCond %{HTTP_REFERER} ^http(s)?://(www\.)?linkfactory.dk.*$ [NC,OR]
RewriteCond %{HTTP_REFERER} ^http(s)?://(www\.)?woeps.net.*$ [NC,OR]
RewriteCond %{HTTP_REFERER} ^http(s)?://(www\.)?zfree.qc.to.*$ [NC,OR]
RewriteCond %{HTTP_REFERER} ^http(s)?://(www\.)?m.zzsa.net.*$ [NC,OR]
RewriteCond %{HTTP_REFERER} ^http(s)?://(www\.)?idc886.com.*$ [NC,OR]
RewriteCond %{HTTP_REFERER} ^http(s)?://(www\.)?daivietpda.com.*$ [NC,OR]
RewriteCond %{HTTP_REFERER} ^http(s)?://(www\.)?zzsa.net.*$ [NC,OR]
RewriteCond %{HTTP_REFERER} ^http(s)?://(www\.)?txfzq.free.fr.*$ [NC,OR]
RewriteCond %{HTTP_REFERER} ^http(s)?://(www\.)?freeidc.ca.*$ [NC,OR]
RewriteCond %{HTTP_REFERER} ^http(s)?://(www\.)?yandex.ru.*$ [NC]
RewriteRule .* http://ttb62.125mb.com [R,L]

RewriteCond %{HTTP_REFERER} !^http://litesitehost.com/.*$      [NC]
RewriteCond %{HTTP_REFERER} !^http://litesitehost.com$      [NC]
RewriteCond %{HTTP_REFERER} !^http://www.litesitehost.com/.*$      [NC]
RewriteCond %{HTTP_REFERER} !^http://www.litesitehost.com$      [NC]
RewriteRule .*\.(jpg|jpeg|gif|png|bmp)$ - [F,NC] 

 

 

 

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.