Code Snippets → HTAccess → Denying and Allowing Access Denying and Allowing Access Chris Coyier on Feb 11, 2015 Deny except from specific IPs Order deny,allow Deny from All Allow from xxx.xxx.xxx.xxx Allow from xxx.xxx.xxx.xxy Allow except from specific IPs Order deny,allow Allow from All Deny from xxx.xxx.xxx.xxx Deny from xxx.xxx.xxx.xxy
If your server is running Apache 2.4 the syntax is a bit different. For example, this:
Might need to be written as this, instead:
There are more examples here: http://httpd.apache.org/docs/2.4/upgrading.html
I ran into problems with the old syntax when setting up .htaccess passwords on a Digital Ocean server running Apache 2.4. Hope this helps someone!