Conditional .Htpasswd for Multi-Environment SetupsNovember 8, 2009
You see when you are working with a multi-environment setup that is synced via a version control system such as Git or Subversion, you need a way to keep your development environments locked down while allowing access to your public environment.
Below is some text that you will input into a .htaccess file placed in your webroot
so in the above code the "testing_uri" part could be if i only wanted to allow this url through my htaccess protections (useful for paypal pings) ex "http://mysite.com/paypal/ipn"
The host part is to allow anyone through if they are requesting the code from a specific domain such as "testing.yoursite.com". If it is "development.yoursite.com" it will not allow the user through.here is the code on css-tricks and here is the code as a github gist
Thanks for reading and as always comments & questions are heavily encouraged!