Results 1 to 9 of 9
  1. #1

    Please help me with htaccess file

    Hello
    I am trying to impose a htaccess file to my website in order to deny the access to some countries. So using google I came out with countryipblocks.net and blockacountry.com which has generated for me a single htaccess deny file for each country.But when I am imposing the .htaceess file I get an internal 500 error for all counties.....In other word I have denied access to my website for all!I have check this with some free proxy servers and the access is denied also to my own country. including my own country I wanted to ask what I am doing wrong and how I should impose the htacess file.Here it is how I have written the file.Note that since I am interesting to block 3 counties I have merged all single htaccess files produced from the above website into one single file.
    Thank you for your assistance



    <Limit GET HEAD POST>
    order allow, deny
    # Country: COUNTRY NAME 1
    # ISO Code: COUNTRY ISO CODE 1
    # Total Networks: 4,188
    # Total Subnets: 82,252,392
    # Country: COUNTRY CODE2
    # ISO Code: COUNTRY ISO CODE 2
    # Total Networks: 473
    # Total Subnets: 8,433,792
    # Country: COUNTRY NAME 3
    # ISO Code: COUNTRY ISO CODE 3
    # Total Networks: 258
    # Total Subnets: 4,868,704
    deny from IP COUNTRY 1
    deny from IP COUNTRY 1
    deny from IP COUNTRY 2
    deny from IP COUNTRY 2
    deny from IP COUNTRY 3
    deny from IP COUNTRY 3
    #
    allow from all
    </Limit>

  2. #2
    Join Date
    Dec 2005
    Location
    I'm Lost...Help
    Posts
    895
    A 500 error does not mean that you are blocked. That is an internal server error stating that something is wrong on the server. Now since this happened when you edited the .htaccess file I am sure there is a problem within that file.

    Do you have any other code in that file? If so can you show us what is in the file. That will help to troubleshoot where the error is.
    Kevin Kopp - MonsterMegs Business Class Hosting Services
    Pure SSD Powered Shared, Reseller, and Enterprise Hosting Solutions
    US & NL Locations :: [US] PhoenixNAP | [NL] EvoSwitch Datacenters

  3. #3
    Join Date
    Feb 2010
    Location
    England, UK
    Posts
    537
    Quote Originally Posted by italos View Post
    <Limit GET HEAD POST>
    order allow, deny
    # Country: COUNTRY NAME 1
    # ISO Code: COUNTRY ISO CODE 1
    # Total Networks: 4,188
    # Total Subnets: 82,252,392
    # Country: COUNTRY CODE2
    # ISO Code: COUNTRY ISO CODE 2
    # Total Networks: 473
    # Total Subnets: 8,433,792
    # Country: COUNTRY NAME 3
    # ISO Code: COUNTRY ISO CODE 3
    # Total Networks: 258
    # Total Subnets: 4,868,704
    deny from IP COUNTRY 1
    deny from IP COUNTRY 1
    deny from IP COUNTRY 2
    deny from IP COUNTRY 2
    deny from IP COUNTRY 3
    deny from IP COUNTRY 3
    #
    allow from all
    </Limit>
    This .htaccess file is completely wrong, it does not specify what IP address to block, which is possibly why your seeing the Internal Server Error.

    I went to countryipblocks.net and chose to block 'AFGHANISTAN' for example, and it generated this code, which I have tested as working...

    <Limit GET HEAD POST>
    order allow,deny
    # Country: AFGHANISTAN
    # ISO Code: AF
    # Total Networks: 21
    # Total Subnets: 94,464
    deny from 27.116.56.0/22
    deny from 58.147.128.0/19
    deny from 61.5.192.0/20
    deny from 111.125.152.0/21
    deny from 111.223.244.0/22
    deny from 117.55.192.0/20
    deny from 117.104.224.0/21
    deny from 119.59.80.0/21
    deny from 121.100.48.0/21
    deny from 121.127.32.0/19
    deny from 125.213.192.0/19
    deny from 175.106.32.0/19
    deny from 180.94.64.0/19
    deny from 180.222.136.0/21
    deny from 182.50.176.0/20
    deny from 202.56.176.0/20
    deny from 202.86.16.0/20
    deny from 203.174.27.0/24
    deny from 203.215.32.0/20
    deny from 210.80.0.0/19
    deny from 210.80.32.0/19
    #
    allow from all
    </Limit>
    I would advise you to go back to countryipblocks.net and use the toolbar on the right to generate another .htaccess file, which should have actual IP address ranges, rather than "IP COUNTRY x"
    Last edited by SercoNetworks; 01-16-2011 at 12:23 PM.

  4. #4
    Quote Originally Posted by SercoNetworks View Post
    This .htaccess file is completely wrong, it does not specify what IP address to block, which is possibly why your seeing the Internal Server Error.

    I went to countryipblocks.net and chose to block 'AFGHANISTAN' for example, and it generated this code, which I have tested as working...



    I would advise you to go back to countryipblocks.net and use the toolbar on the right to generate another .htaccess file, which should have actual IP address ranges, rather than "IP COUNTRY x"
    I eliminated the countries and codes for privacy. Here it is how I generated,

    Limit GET HEAD POST>
    order allow, deny
    # Country: UNITED KINGDOM
    # ISO Code: GB
    # Total Networks: 4,188
    # Total Subnets: 82,252,392
    # Country: BELGIUM
    # ISO Code: BE
    # Total Networks: 473
    # Total Subnets: 8,433,792
    # Country: IRELAND
    # ISO Code: IE
    # Total Networks: 258
    # Total Subnets: 4,868,704
    deny from 2.96.0.0/13
    deny from 2.120.0.0/13
    deny from 2.216.0.0/13
    deny from 25.0.0.0/8
    deny from 31.48.0.0/13
    deny from 31.64.0.0/11
    deny from 31.96.0.0/11
    deny from 46.16.0.0/21
    deny from 46.16.32.0/21
    deny from 46.16.80.0/21
    deny from 46.16.160.0/21
    deny from 46.16.184.0/21
    deny from 46.16.208.0/21
    deny from 46.17.56.0/21
    deny from 46.17.88.0/21
    deny from 46.17.160.0/21
    deny from 46.17.176.0/21
    deny from 46.17.208.0/21
    deny from 46.17.216.0/21
    deny from 46.17.232.0/21
    deny from 46.18.8.0/21
    #
    allow from all
    </Limit>


    Now imagine there are many IP addressees there(more than 1000) but I have only included a very limited number just to give you an idea how I wrote the htaccess file
    Is this form correct?How can I write a htaccess file for more than two countries????

  5. #5
    Join Date
    Feb 2010
    Location
    England, UK
    Posts
    537
    Quote Originally Posted by italos View Post
    How can I write a htaccess file for more than two countries????
    On the .htaccess file generator at countryipblocks.net, you should be able to hold down 'ctrl' on your keyboard and select multiple countries.

  6. #6

  7. Internal 500 error means the web server running the web site encountered an unexpected condition that prevented it from fulfilling the request by the client for access to the requested URL.

    This is a 'catch-all' error generated by the Web server. Basically something has gone wrong, but the server can not be more specific about the error condition in its response to the client. In addition to the 500 error notified back to the client, the Web server should generate some kind of internal error log which gives more details of what went wrong. It is up to the operators of the Web server site to locate and analyse these logs.

    You can also write it this way:

    <Files 403.shtml>
    order allow,deny
    allow from all
    </Files>

    deny from 27.116.56.0/22
    deny from 58.147.128.0/19
    deny from 61.5.192.0/20
    deny from 111.125.152.0/21
    deny from 111.223.244.0/22
    deny from 117.55.192.0/20
    deny from 117.104.224.0/21
    deny from 119.59.80.0/21
    deny from 121.100.48.0/21
    deny from 121.127.32.0/19
    deny from 125.213.192.0/19
    deny from 175.106.32.0/19
    deny from 180.94.64.0/19
    deny from 180.222.136.0/21
    deny from 182.50.176.0/20
    deny from 202.56.176.0/20
    deny from 202.86.16.0/20
    deny from 203.174.27.0/24
    deny from 203.215.32.0/20
    deny from 210.80.0.0/19
    deny from 210.80.32.0/19

  8. #8
    Hi

    This is really usful information given here


    Thanks

  9. #9
    Join Date
    Mar 2007
    Posts
    283
    Try with IP ranges from:
    http://www.ipaddresslocation.org/ip_...get_ranges.php
    http://www.find-ip-address.org/ip-country/

    For example:

    <Limit GET HEAD POST>
    order allow,deny
    deny from 85.94.160.0/19
    deny from 91.187.64.0/19
    deny from 194.117.123.178/32
    deny from 194.158.64.0/19
    deny from 195.112.181.196/32
    deny from 195.112.181.247/32
    allow from all
    </LIMIT>

Similar Threads

  1. help with .htaccess file
    By ChatNSN Comms in forum Web Hosting
    Replies: 4
    Last Post: 08-03-2009, 10:54 PM
  2. HTACCESS file?
    By apina in forum Programming Discussion
    Replies: 0
    Last Post: 09-19-2006, 10:13 PM
  3. .htaccess file [help]
    By 5need in forum Hosting Security and Technology
    Replies: 4
    Last Post: 06-20-2004, 04:03 PM
  4. need help with htaccess file
    By shute in forum Hosting Security and Technology
    Replies: 3
    Last Post: 06-05-2002, 07:35 PM
  5. How to use a .htaccess file?
    By filburt1 in forum Web Hosting Lounge
    Replies: 4
    Last Post: 03-30-2002, 08:07 PM

Posting Permissions

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