Results 1 to 9 of 9
-
01-16-2011, 11:06 AM #1New Member
- Join Date
- Jan 2011
- Posts
- 2
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>
-
01-16-2011, 12:01 PM #2Web Hosting Master
- 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
-
01-16-2011, 12:16 PM #3Web Hosting Evangelist
- Join Date
- Feb 2010
- Location
- England, UK
- Posts
- 537
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>Last edited by SercoNetworks; 01-16-2011 at 12:23 PM.
-
01-16-2011, 12:39 PM #4New Member
- Join Date
- Jan 2011
- Posts
- 2
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????
-
01-16-2011, 12:45 PM #5Web Hosting Evangelist
- Join Date
- Feb 2010
- Location
- England, UK
- Posts
- 537
-
01-16-2011, 12:50 PM #6Newbie
- Join Date
- Nov 2010
- Posts
- 13
Try this: http://www.maxmind.com/app/mod_geoip
-
01-16-2011, 04:20 PM #7Newbie
- Join Date
- Jan 2011
- Posts
- 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
-
01-17-2011, 07:58 AM #8Newbie
- Join Date
- Jan 2011
- Posts
- 7
Hi
This is really usful information given here
Thanks
-
01-17-2011, 09:45 AM #9Web Hosting Guru
- 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
-
help with .htaccess file
By ChatNSN Comms in forum Web HostingReplies: 4Last Post: 08-03-2009, 10:54 PM -
HTACCESS file?
By apina in forum Programming DiscussionReplies: 0Last Post: 09-19-2006, 10:13 PM -
.htaccess file [help]
By 5need in forum Hosting Security and TechnologyReplies: 4Last Post: 06-20-2004, 04:03 PM -
need help with htaccess file
By shute in forum Hosting Security and TechnologyReplies: 3Last Post: 06-05-2002, 07:35 PM -
How to use a .htaccess file?
By filburt1 in forum Web Hosting LoungeReplies: 4Last Post: 03-30-2002, 08:07 PM