htaccess expert needed...

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • BabeHunter
    Webmaster
    • Oct 2001
    • 4063

    #1

    htaccess expert needed...

    I need an htaccess file that redirects visitors based on ip blocks...
    for example i have all the ip blocks for japan...and i want to redirect them all to an ad page...
    can you do it?
    contact me at [email protected]
    let me know...if it do what i need i'm willing to pay...hehe
    Yep
  • zubr
    Confirmed User
    • Jan 2002
    • 1227

    #2
    Add the following to the .htaccess file:

    < Limit GET >
    order allow,deny
    deny from .jp
    allow from all
    < /Limit >

    ErrorDocument 403 http://japanese-popup-hell.com

    --------------------------------------
    Remove unnecessary spaces, otherwise part of the code wouldnt show up
    Last edited by zubr; 06-11-2002, 06:57 AM.
    Alex - ICQ:61889253 - MSN:zubr_zubr at hotmail.com - Skype:zubrzubr

    Comment

    • BabeHunter
      Webmaster
      • Oct 2001
      • 4063

      #3
      Originally posted by zubr
      Add the following to the .htaccess file:

      <Limit GET>
      order allow,deny
      deny from .jp
      allow from all
      </Limit>

      ErrorDocument 403 http://japanese-popup-hell.com
      thanks man...but does it mean that only the ppl the come from domain.jp will be redirected? what about a japanese surfer that comes from domain.com?
      Yep

      Comment

      • Rocco
        Registered User
        • May 2002
        • 30

        #4
        Yes probably the surfer too....

        But why you don't block each IP Instead of a large IPS?

        Rocco

        Comment

        • salsbury
          Confirmed User
          • Feb 2002
          • 1070

          #5
          here's what i've got. it's a freebie, 'cause salsbury's a nice guy. (and 'cause i don't know if it'll work perfectly as-is. ;))

          just a word of advice: using deny or allow with any type of hostname will force hostnamelookups on, which will slow down your surfer's experience. ie it's not so good.

          create a file called "punklist.txt" in your site's root directory. add IP blocks and URLs to the file as so:

          192.168.0 http://www.someblindlinksponsor.com/
          127.0.0 http://www.whitehouse.gov/

          etc. basically it expects to have the first 3 octets there. next, add the following to your httpd.conf file in your VirtualHost directive:

          RewriteMap punk-o txt:/path/to/server/root/punklist.txt
          RewriteCond %{REMOTE_ADDR} ^([0-9]*\.[0-9]*\.[0-9]*)\.[0-9]*
          RewriteCond ${punk-o:%1|OK-TO-PASS} !=OK-TO-PASS
          RewriteRule ^/.* ${punk-o:%1} [R,L]

          unfortunately it won't work in the .htaccess file for whatever reason, silly apache.

          if you'd like an explanation of all this, hit me for e-mail [email protected] . holy crap that took a lot longer to figure out than i expected. but it does indeed work.

          Comment

          • BabeHunter
            Webmaster
            • Oct 2001
            • 4063

            #6
            Originally posted by salsbury
            here's what i've got. it's a freebie, 'cause salsbury's a nice guy. (and 'cause i don't know if it'll work perfectly as-is. ;))

            just a word of advice: using deny or allow with any type of hostname will force hostnamelookups on, which will slow down your surfer's experience. ie it's not so good.

            create a file called "punklist.txt" in your site's root directory. add IP blocks and URLs to the file as so:

            192.168.0 http://www.someblindlinksponsor.com/
            127.0.0 http://www.whitehouse.gov/

            etc. basically it expects to have the first 3 octets there. next, add the following to your httpd.conf file in your VirtualHost directive:

            RewriteMap punk-o txt:/path/to/server/root/punklist.txt
            RewriteCond %{REMOTE_ADDR} ^([0-9]*\.[0-9]*\.[0-9]*)\.[0-9]*
            RewriteCond ${punk-o:%1|OK-TO-PASS} !=OK-TO-PASS
            RewriteRule ^/.* ${punk-o:%1} [R,L]

            unfortunately it won't work in the .htaccess file for whatever reason, silly apache.

            if you'd like an explanation of all this, hit me for e-mail [email protected] . holy crap that took a lot longer to figure out than i expected. but it does indeed work.
            Thanks man...but...the ip list that i have...is REALLY long...it will take days to write it...hehe
            but thanks anyways
            Yep

            Comment

            • salsbury
              Confirmed User
              • Feb 2002
              • 1070

              #7
              np. however it probably wouldn't be too hard to set up the list with a good text editor like vi. in any case good luck.

              Comment

              • fiveyes
                Confirmed User
                • Aug 2001
                • 1680

                #8
                Mmm, challenging, that. I love it!

                Let's see,

                order deny,allow

                # Deny from a specific IP number
                deny from 123.45.67.89

                # Deny from 123.45.6.0 - 123.45.6.255
                deny from 123.45.6

                # Deny from 123.45.6.34 - 123.45.6.46
                deny from 123.45.6.32/28

                ...

                The last one, using netmasks, is the brain cruncher!

                See http://httpd.apache.org/docs/mod/mod_access.html#allow
                http://www.darklab.net/resources/netmask.html
                http://metronet.min.net/Netmasks
                http://handsonhowto.com/lan101.html
                for what's needed...
                <CENTER><A HREF="http://www.hot-off-bourbon.com/" target="_blank"><IMG SRC="http://www.hot-off-bourbon.com/images/hob-logosmall.jpg" border="0"></A>

                <FONT face="Comic Sans MS" SIZE="-1"><I>Mardi Gras, Spring Break, Wet-T, Night Club Action, UpSkirt, Oil Wrestling, Voyeur</I></FONT></CENTER>

                Comment

                • BabeHunter
                  Webmaster
                  • Oct 2001
                  • 4063

                  #9
                  Thanks guys
                  Yep

                  Comment

                  • vegasdude
                    Confirmed User
                    • Jul 2001
                    • 3649

                    #10
                    I hate htaccess!!!
                    Did you fucking talk to me??!
                    Who the fuck told you to talk to me??!"

                    Comment

                    Working...