It's safe to produce a .htaccess inside a folder during my website ( and just allow MY Ip?

Let me Make Certain that nobody else than me access this folder. This is a login within this folder but I'd rather have a crazy-full access protection.

Is safe? It is possible to method to hack this?

Note: I do not worry about the inability to can get on from elsewhere. This site gets compromised by Ukraine, Vietnam, Philippines, Algeria, China within the last 4 several weeks which nolife are driving me nuts.

Also, it is possible to simple method to only allow IP/computer systems from ONLY Canada &lifier USA? I do not have clients elsewhere anyway.

Thanks a lot


Put these 3 lines on the top of the .htaccess file within the folder you need to restrict:

Order deny,allow
Deny from all
Allow from

This can only allow use of that folder from Ip otherwise it'll show forbidden error.

Type of moving in reverse order of the question:

While there might be some general association of geographic place to Ip range, you shouldn't rely on it.

Let's say your clients in Canada wish to access your website via a proxy in Europe? You need to use a "real" authentication approach to verify customers, not Ip.

Using specific Insolvency practitioners is much better, presuming individuals customers have static Insolvency practitioners. This not really a safe assumption for any dial-up or DSL-based user, though (for instance).

Should you yourself possess a static IP, then yes, it ought to be fine to limit use of a folder according to that. Obviously should you ever release that IP or switch Web service provider, etc. you'll have to improve your website's configuration. Yet another factor to need to remember.

You might get a VPN and just restricting your page's accessibility local network (see anubhava's answer - note the 192.168.XX.XX address).

Personally, I personally use a mix of HTTPS + username + good password for that.