I need to deny access on a website at a specific country, but allow to bypass via .htaccess authentication

I found this website https://www.ip2location.com/blockvisitorsbycountry.aspx

where I can download an .htaccess that deny access from a specific country, but I'm not sure if is possible to add the ability to proceed with a user / password

order allow,deny
allow from all
deny from 123.456.789.0/255 

placing this in root folder would also deny access to Google Robots outside that country?


Have you looked at the 'satisfy' directive?:

The Satisfy directive can be used to specify that several criteria may be considered when trying to decide if a particular user will be granted admission. Satisfy can take as an argument one of two options - all or any. By default, it is assumed that the value is all. This means that if several criteria are specified, then all of them must be met in order for someone to get in. However, if set to any, then several criteria may be specified, but if the user satisfies any of these, then they will be granted entrance.


  • it seems to work – al404IT Jul 20 '17 at 13:37

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.