Apache Trouble

blimpblimp Join Date: 2003-03-12 Member: 14438Members, Constellation
<div class="IPBDescription">.. blocking certain referers</div> Okay. I'm a mirror. I don't mind people downloading and using all my bandwith. What I do mind, is a certain french site using me as their main mirror and taking credit for it.

Therefore, I've been trying to block downloads when their site is the referrer. No such luck.

I ask for help to fix this, as I find it wrong for certain people to just rip me off like this.

############

I'm using .htaccess to fix this problem.

.htaccess in the folder where the files are (This one accepts specific domains)
<!--c1--></div><table border='0' align='center' width='95%' cellpadding='3' cellspacing='1'><tr><td><b>CODE</b> </td></tr><tr><td id='CODE'><!--ec1-->RewriteEngine on
RewriteCond %{HTTP_REFERER} !^$
RewriteCond %{HTTP_REFERER} !^http://panama.mine.nu/~files/ns/.*$       [NC]
RewriteCond %{HTTP_REFERER} !^http://www.kfs-gaming.com/.*$       [NC]
RewriteCond %{HTTP_REFERER} !^http://natural-selection.org/downloads.html.*$      [NC]
RewriteCond %{HTTP_REFERER} !^http://www.natural-selection.org/downloads.html.*$ [NC]
RewriteRule .*$      http://kfs-gaming.com/images/squad/make.jpg<!--c2--></td></tr></table><div class='postcolor'><!--ec2-->

This one should allow people panama.mine.nu, kfs-gaming.com and natural-selection.org. What happens is that everyone gets blocked (403).

So. Lets try a new approach! (Blocking specific domains)
<!--c1--></div><table border='0' align='center' width='95%' cellpadding='3' cellspacing='1'><tr><td><b>CODE</b> </td></tr><tr><td id='CODE'><!--ec1-->Rewriteengine on

RewriteCond %{HTTP_REFERER} ^http://www.removed-domain-for-flaming.com/.*$ [NC,OR]
RewriteCond %{HTTP_REFERER} ^http://www.removed-domain-for-flaming.nu/.*$ [NC,OR]
RewriteCond %{HTTP_REFERER} ^http://www.openlan.net/.*$ [NC,OR]
RewriteCond %{HTTP_REFERER} ^http://wwwstud.hint.no/.*$ [NC]

RewriteRule .*\.(gif|GIF|jpg|JPG|exe|EXE)$ http://www.kfs-gaming.com/?go=download [R]<!--c2--></td></tr></table><div class='postcolor'><!--ec2-->
The domains that are in the list are for testing (obviously, the two first, are not). Same thing happens here; everyone gets blocked (403).

All files in the folder are chmodded to 755.

My <a href='http://panama.mine.nu/httpd.conf' target='_blank'>httpd.conf</a>

Comments

  • blimpblimp Join Date: 2003-03-12 Member: 14438Members, Constellation
    Noone knows anything about apache?

    CRAZY BUMP
  • chis1chis1 Join Date: 2004-01-13 Member: 25281Members
    Maybe they dont care

    /me runs
  • ZeroByteZeroByte Join Date: 2002-11-01 Member: 3057Members
    Idunno how to fix that... but here's some .htaccess tutorial's. Might help you out in your problems.

    <a href='http://www.freewebmasterhelp.com/tutorials/htaccess/1' target='_blank'>http://www.freewebmasterhelp.com/tutorials/htaccess/1</a>
    <a href='http://www.javascriptkit.com/howto/htaccess.shtml' target='_blank'>http://www.javascriptkit.com/howto/htaccess.shtml</a>
  • CheesyPetezaCheesyPeteza Join Date: 2002-11-24 Member: 9784Members, NS1 Playtester, Constellation
    Here is what I use to stop people leeching my avatar I use here on natural-selection.org:

    <!--c1--></div><table border='0' align='center' width='95%' cellpadding='3' cellspacing='1'><tr><td><b>CODE</b> </td></tr><tr><td id='CODE'><!--ec1-->RewriteEngine on
    RewriteCond %{HTTP_REFERER} ^$ [OR]
    RewriteCond %{HTTP_REFERER} !^http://(.*)natural-selection\.org/.*$ [NC]
    RewriteRule .*\.([gif|jpe?g]+)$ - [NC,F]<!--c2--></td></tr></table><div class='postcolor'><!--ec2-->
  • havenhaven Join Date: 2002-11-15 Member: 8767Members
    Personally I would try and achieve what you are doing using the DENY directive.

    Simply set up a .htaccess within the relevant directory and configure the access controls as per the guides set out in the manual:

    <a href='http://httpd.apache.org/docs-2.0/howto/auth.html' target='_blank'>http://httpd.apache.org/docs-2.0/howto/auth.html</a>

    The rewrites you have shown are also valid but a lot more complex to implement.

    In my book always choose the path of least resistance i.e. the easy option. Just block the hosts directly using access controls.

    Regards

    Haven
  • blimpblimp Join Date: 2003-03-12 Member: 14438Members, Constellation
    Haven, I am trying to block referers. How can I achieve that with the Deny rule?

    It looks to me I can only deny specific hosts, and I'm not able to block every person downloading via. another site.
  • havenhaven Join Date: 2002-11-15 Member: 8767Members
    You have a point, appologies I should have thought that one through a little more before posting - I simply thought of blocking the host but didnt think through that referals come from the client and not the host ...
  • blimpblimp Join Date: 2003-03-12 Member: 14438Members, Constellation
    <!--QuoteBegin-haven+Feb 5 2004, 03:45 AM--></div><table border='0' align='center' width='95%' cellpadding='3' cellspacing='1'><tr><td><b>QUOTE</b> (haven @ Feb 5 2004, 03:45 AM)</td></tr><tr><td id='QUOTE'><!--QuoteEBegin--> You have a point, appologies I should have thought that one through a little more before posting - I simply thought of blocking the host but didnt think through that referals come from the client and not the host ... <!--QuoteEnd--> </td></tr></table><div class='postcolor'> <!--QuoteEEnd-->
    Don't worry Haven, we're only human.



    If anyone feels like checking my httpd.conf for errors I'd be happy, I'm pretty sure thats where the problem is, since my syntax is correct and all.
Sign In or Register to comment.