Conditional .Htpasswd for Multi-Environment Setups
Published on November 8th, 2009
<p> 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. </p> <p> Below is some text that you will input into a .htaccess file placed in your webroot </p> <script src="https://gist.github.com/1397070.js?file=gistfile1.txt"></script> <p> 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" </p> <p> 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. </p> <a href="http://css-tricks.com/snippets/htaccess/allow-single-url/" target="_blank">here is the code on css-tricks</a> and <a href="http://gist.github.com/229178" target="_blank">here is the code as a github gist</a> <p> Thanks for reading and as always comments & questions are heavily encouraged!