Submit Your Article Forum Rules

Results 1 to 8 of 8

Thread: .htaccess deny,allow - is it working to limit to usa only visitors?

  1. #1
    Senior Member AuctionHugh's Avatar
    Join Date
    Jul 2004
    Posts
    201

    Question .htaccess deny,allow - is it working to limit to usa only visitors?

    Never sure what part of the forum questions like this should go in....

    Using the file found here: http://www.countryipblocks.net/count...-allow-format/ I have set up an .htaccess file to only allow USA visitors to my site.

    My goal is to stop getting contacts from various up and coming countries offering to sell me unwanted SEO services.

    However, shortly after adding the ip ranges to my .htaccess file on my server, I had a hit from pakistan, not one of the allowed IP Ranges.

    I have the .htaccess set up like this:

    Options +FollowSymlinks
    RewriteEngine On
    RewriteCond %{HTTP_HOST} ^kallenweb.com
    RewriteRule (.*) http://www.kallenweb.com/$1 [R=301,L]
    # prevents a directory listing when typing in the directory path in the browser
    Options -Indexes
    #
    # ONLY ALLOWING USA IPS V4 ONLY
    # USING A LIST FROM HERE ww w.countryipblocks.net/country-blocks/htaccess-allow-format/
    order deny,allow
    deny from all
    # Country: UNITED STATES
    # ISO Code: US
    allow from 3.0.0.0/8
    allow from 4.0.0.0/8
    allow from 6.0.0.0/8
    allow from 7.0.0.0/8
    allow from 8.0.0.0/8
    allow from 9.0.0.0/8
    allow from 11.0.0.0/8
    etc etc - thousands of lines of allowed US IP ranges
    If you are not from the USA, can you successfully see my website here?: http://www.kallenweb.com

    Anyone have any knowledgeable suggestions for my .htaccess file?
    Hidden Content <- SW Michigan
    Hidden Content <- Is this effective?
    Hidden Content <- West Michigan

  2. #2
    Administrator weegillis's Avatar
    Join Date
    Oct 2003
    Posts
    5,789
    From Canada I get a 403.

  3. #3
    Administrator weegillis's Avatar
    Join Date
    Oct 2003
    Posts
    5,789
    This is just a stab at the question, but have you considered that perhaps like many others, even while based offshore, they might be using a US based ISP? I don't know that it's possible, but it seems probable. Just speculation, as per my usual self.

  4. #4
    Senior Member AuctionHugh's Avatar
    Join Date
    Jul 2004
    Posts
    201
    Yes, and of course I realize this may cause more problems than it solves. I would exclude non north america continents or include all of north america, but this adds many thousands more IP lines to my .htaccess file and I'm concerned with every pageload being slowed due to that. I would like to allow our honored neighbors to the north but doing so adds 6000 lines to my .htaccess file, which is already almost 40,000 lines long just to allow all USA IP ranges!

    I'm not sure all this is worth it, but if it has no overhead really and prevents my regular broken english SEO assistance spam, I will keep it. Thoughts?
    Hidden Content <- SW Michigan
    Hidden Content <- Is this effective?
    Hidden Content <- West Michigan

  5. #5
    Administrator weegillis's Avatar
    Join Date
    Oct 2003
    Posts
    5,789
    Again, just an opinion, but need you go to all that trouble just to stop a little spam? Even if you deny access to the site, it will still come up in SERPS worldwide, from that automated systems will still take a kick at the usual fare of common e-mail addresses (info, webmaster, etc.) I've always doubted that any of these SEO scammers has ever looked at any of my sites, with a couple of Canadian based exceptions. The mail goes straight in the trash in most cases.
    Last edited by weegillis; 07-09-2011 at 04:45 PM. Reason: italics

  6. #6
    Senior Member OLYMPOS's Avatar
    Join Date
    Aug 2005
    Posts
    181
    Quote Originally Posted by AuctionHugh View Post



    If you are not from the USA, can you successfully see my website here?: http://www.kallenweb.com
    I'm currently in the city of angels, Krung Thep, Thailand, getting a

    Forbidden

    You don't have permission to access / on this server.
    greetings from Istanbul
    Hidden Content | Hidden Content | Hidden Content

  7. #7
    Senior Member AuctionHugh's Avatar
    Join Date
    Jul 2004
    Posts
    201
    Quote Originally Posted by weegillis View Post
    I've always doubted that any of these SEO scammers has ever looked at any of my sites, with a couple of Canadian based exceptions. The mail goes straight in the trash in most cases.
    My statcounter shows quite a few hits from india, pakistan, etc., often followed by spam email and/or a waste-of-my-time phone call for seo services.

    Quote Originally Posted by OLYMPOS View Post
    I'm currently in the city of angels, Krung Thep, Thailand, getting a

    Forbidden

    You don't have permission to access / on this server.
    Thank you, very helpful.
    Hidden Content <- SW Michigan
    Hidden Content <- Is this effective?
    Hidden Content <- West Michigan

  8. #8
    Junior Member
    Join Date
    Mar 2012
    Posts
    1

    Add two Non US IPs to allowed list?

    I wanted to add the IP of myself and my partner as allowed to view the webpage as we're offshore from US. This is the code from countryipblocks.net with the added two lines in red below:

    <Limit GET POST>
    order deny,allow
    # Country: UNITED STATES
    # ISO Code: US
    # Total Networks: 42,463
    # Total Subnets: 1,540,617,344
    allow from MyPhilippinesIP
    allow from My Partner's IP

    allow from 3.0.0.0/8
    allow from 4.0.0.0/8
    allow from 6.0.0.0/8
    ...

    I got this error when I tried to load the page:
    Internal Server Error

    The server encountered an internal error or misconfiguration and was unable to complete your request.

    Please contact the server administrator, webmaster at xyz.com and inform them of the time the error occurred, and anything you might have done that may have caused the error.

    More information about this error may be available in the server error log.

    Additionally, a 500 Internal Server Error error was encountered while trying to use an ErrorDocument to handle the request.

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •