If this is your first visit, check our documentation. To post, register or login.
Forums / Installing on a Windows Server / block ip country

block ip country

Started by peapea on 13 Jan 2011, 10:21 AM · Views: 8,156

Results 1 to 8 of 8
13 Jan 2011, 10:21 AM
#1
peapea avatar

peapea

New Zenner

Join Date:
Jan 2011
Posts:
4
Plugin Contributions:
0

block ip country

How to block viewer ( country ) by .Htaccess ?

please step by step:laugh:

14 Jan 2011, 7:09 AM
#2
nojja567 avatar

nojja567

New Zenner

Join Date:
Jan 2011
Location:
India
Posts:
1
Plugin Contributions:
0

Re: block ip country

peapea:

How to block viewer ( country ) by .Htaccess ?

please step by step:laugh:

I don't known about it.

Nojja567
Katha

14 Jan 2011, 10:32 AM
#3
kobra avatar

kobra

Black Belt

Join Date:
Aug 2005
Location:
Arizona
Posts:
31,500
Plugin Contributions:
4

Re: block ip country

Yu will need to determine the countrys range of ip's or CIDR

The following site will generate a CIDR deny list for you to paste into your htaccess file

Just select IP ranges by Ip Country Location and output as CIDR

http://www.find-ip-address.org/ip-country/

Zen-Venom Get Bitten

2 Oct 2012, 1:12 PM
#4
veedub3 avatar

veedub3

New Zenner

Join Date:
Dec 2008
Location:
Atlanta, GA/Panama City, Panama
Posts:
30
Plugin Contributions:
0

Re: block ip country

Can someone tell me which folder does the .htaccess file belong in? I have found the list to block IP's online, I placed it in my .htaccess file but I noticed that several folders have an .htaccess file so which one should have this information to ban certain visitors? Currently I have placed the code in every .htaccess file I found and added my own IP and of course I can still see my site.

This is the file I added to my .htaccess file:

<Files *>
order allow,deny
deny from 127.0.0.1 (I changed this to my IP address)
allow from all
</Files>

Is this correct?

Thanks in advance for your help.
Vee

Add Info: When I add the code to all the .htaccess files I have found, when I try to log into my Zencart admin, I get an error page that my hosting providers says is a corrupt .htaccess file.

2 Oct 2012, 3:28 PM
#5
drbyte avatar

drbyte

Sensei

Join Date:
Jan 2004
Posts:
63,512
Plugin Contributions:
176

Re: block ip country

Zen Cart comes with .htaccess files located INSIDE SUBDIRECTORIES ONLY. YOU DO NOT EDIT THESE FILES.

Zen Cart specifically comes with NO .htaccess file in the root of your store, because Zen Cart doesn't need one there in order to run.

So:

  1. Remove all the things you just added to the existing .htaccess files located in various subdirectories under your Zen Cart folders.
  2. Then add your own new .htaccess file into the root of your store ... that would be the same folder as files like ipn_main_handler.php

.
Zen Cart - putting the dream of business ownership within reach of anyone!
Donate to: DrByte directly or to the Zen Cart team as a whole

Remember: Any code suggestions you see here are merely suggestions. You assume full responsibility for your use of any such suggestions, including any impact ANY alterations you make to your site may have on your PCI compliance.
Furthermore, any advice you see here about PCI matters is merely an opinion, and should not be relied upon as "official". Official PCI information should be obtained from the PCI Security Council directly or from one of their authorized Assessors.

2 Oct 2012, 4:30 PM
#6
veedub3 avatar

veedub3

New Zenner

Join Date:
Dec 2008
Location:
Atlanta, GA/Panama City, Panama
Posts:
30
Plugin Contributions:
0

Re: block ip country

Thank you very much that did it.

Vee

18 Nov 2014, 12:28 AM
#7
firedealer avatar

firedealer

New Zenner

Join Date:
Jun 2009
Posts:
1
Plugin Contributions:
0

Re: block ip country

veedub3:

Thank you very much that did it.

Vee

After talking to my server tech support they informed me that blocking ip addresses through the .htaccess or ip deny in my control panel will eventually effect the visitors that I want to show up and access my site because the the IP addresses are always changing globally. users IP in china, ukraine or russia may become an ip address for some user in the us therefore blocking potential customers in the us... check with your server and verify my findings.

20 Nov 2014, 8:13 PM
#8
drbyte avatar

drbyte

Sensei

Join Date:
Jan 2004
Posts:
63,512
Plugin Contributions:
176

Re: block ip country

firedealer:

... because the the IP addresses are always changing globally. users IP in china, ukraine or russia may become an ip address for some user in the US therefore blocking potential customers in the US...
IMO that's a bit of a stretch. While it's technically possible, it's relatively rare that IPs change to represent different country locations.

Nevertheless, it is wise to regularly review any IP addresses you've blocked to be sure you still need/want to block them.

.
Zen Cart - putting the dream of business ownership within reach of anyone!
Donate to: DrByte directly or to the Zen Cart team as a whole

Remember: Any code suggestions you see here are merely suggestions. You assume full responsibility for your use of any such suggestions, including any impact ANY alterations you make to your site may have on your PCI compliance.
Furthermore, any advice you see here about PCI matters is merely an opinion, and should not be relied upon as "official". Official PCI information should be obtained from the PCI Security Council directly or from one of their authorized Assessors.