.htaccess HELP

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • sexyclicks
    Confirmed User
    • Mar 2002
    • 3240

    #1

    .htaccess HELP

    I want to allow certain referers using .htaccess (or anything similar)

    For example when the user is coming from mydomain1.com is allowed to enter but if coming from mydomain2.com is not....

    Example:
    Code:
    <Limit GET>                                                                
    order deny,allow
    deny from all
    referer allow from [url]http://yourdomain.com/[/url]*
    </Limit>
    Am I crazy?
  • salsbury
    Confirmed User
    • Feb 2002
    • 1070

    #2
    you're not crazy, it'd be nice if it worked that way, but it's a bit more complex.

    just a warning though: this isn't perfect. referrers are frequently broken or just plain missing. it's not really wise to only allow certain referers in unless you also allow null referers and some of those all x referers some software generates.

    ok, with that said, here goes.

    let's assume you just want to allow all referers in except one:

    RewriteEngine on
    RewriteCond %{HTTP_REFERER} http://www.baddomain.com/ [NC]
    RewriteRule /* http://www.yahoo.com/ [R,L]

    you can use ! in front of the http:// on the RewriteCond line to negate the conditional. check hotlink protection .htaccess rules for more details, or Apache's excellent guide http://httpd.apache.org/docs/misc/rewriteguide.html
    Last edited by salsbury; 09-16-2002, 03:36 PM.

    Comment

    • Buck
      Registered User
      • Sep 2002
      • 27

      #3
      AuthUserFile /dev/null
      AuthGroupFile /dev/null

      RewriteEngine On
      RewriteCond %{HTTP_REFERER} !^http://YOURDOMAIN.com/ [NC]
      RewriteCond %{HTTP_REFERER} !^http://www.YOURDOMAIN.com/ [NC]
      RewriteCond %{HTTP_REFERER} !^http://www.YOURIP/ [NC]
      RewriteRule /* http://www.YOUR_DOMAIN.com/ [R,L]

      Comment

      • some_idiot
        Confirmed User
        • May 2002
        • 1511

        #4
        Originally posted by sexyclicks
        I want to allow certain referers using .htaccess (or anything similar)

        For example when the user is coming from mydomain1.com is allowed to enter but if coming from mydomain2.com is not....

        Example:
        Code:
        Limit GET                                                               
        order deny,allow
        deny from all
        referer allow from [url]http://yourdomain.com/[/url]*
        /Limit
        Am I crazy?
        You seem to have httpd.conf commands here not
        htaccess.

        If you want htaccess from a referrer, use the rewrite
        conditional.

        RewriteEngine On
        RewriteCond %{HTTP_REFERER} !^http://*yourdomain.com/ [NC]
        RewriteRule /* http://send.badguys.here.com/ [R,L]

        ... do you want the httpd.conf for doing similar?

        This AVS pays my mortgage!

        Comment

        • sexyclicks
          Confirmed User
          • Mar 2002
          • 3240

          #5
          YOU GUYS ROCK!!!!

          I am trying 1 hour reading shit like this one here http://accessreferer.sourceforge.net...#allow_referer and in less than 3 min my problem is solved from GFY crew!!!

          Comment

          • HQ
            Confirmed User
            • Jan 2001
            • 3539

            #6
            Keep in mind that anyone using Norton (and the likes) have their HTTP_REFERERs blocked (they are deleted and do not exist).

            Comment

            Working...