( Thoughts of a Software Engineer: Today, Yesterday & Tomorrow )

About Me

I am a Software Engineer with over 12 years of experience. Programming is not only a skill, but my passion. Visit my online portfolio for highlights of some recent projects I have worked on. In my spare time I enjoy hiking, skiing, & water sports - pretty much anything outdoors.

Advertisements

Password Protect All but One File (htaccess)

by Brett on July 20, 2008

Once in a while need to allow someone access to one file but no other files in the same directory. I often solve this problem by moving the one file to a sub directory and then adding the following to an htaccess file in that same sub directory.

allow from all
satisfy any

This normally works well but is not a perfect solution since it is not always appropriate to move the file to a different directory. So, I took the time and figured out how to password protect everything but one file. Below is the basic password protection that I had in the htaccess file that blocked everything in the directory (and sub-directories).