Simple Directory Protection with .htaccess

September 08, 2010

To deny access to a folder or directory, simply create a new .htaccess file inside that directory.

Then depending on the authorisation type you want to use you can make rules to allow or deny access.
View some examples below.

Allow by Ip

order allow,deny
allow from 85.189.58.21
deny from all

This denys anyone not on ip 85.189.58.21 access to your folder.


About me

Hello! I'm David Heward, how are you going? I'm a Senior Devops/Build Engineer, specialising in AWS & Cloud Automation. Based in London. Strong 10+ year background in Software development. Have a read of my blog. Have a look at some of my working projects. Contact me at @davehewy or on Linkedin.