IP Based Htaccess Restriction

A couple of months ago, I was looking for a way to restrict a development site in such a way, that while people were at work (where we have a static IP), and then require a .htpasswd file for everyone outside.

Well, it was actually kind of simple. After you've got your .htpasswd file set up, just throw this inside your vhost

AuthName "Change This"
AuthUserFile /path/to/.htpasswd
AuthType Basic
Satisy Any
<Limit GET POST>
	Order Deny,Allow
	Deny from all
	Allow from 12.34.56.789
	Require valid-user
</Limit>

For your environment, you should change the AuthName, the AuthUserFile, the Limit (maybe, GET and POST might be enough), and the IP (12.34.56.789).

Change out the variables for what your environment requires, and you should be all set.

Related Posts

jQuery: Roll to Next Input

I was looking for a way to have an input, that when you change, would roll to the next input. The project I'm working on has a page based system, so each page has its own fieldset. When the last field is completed, I wanted it to automatically roll to the next page. I also wanted functionality for zip code, and phone number fields, that would roll to the next input after 5 digits on zip, or roll to the next piece of the phone number field.