Tuesday, 5 May 2015

htaccess allow for IP address and should not ask for Authentication

htaccess allow for IP address and should not ask for Authentication

Requirement:

Working on some project in office where all developer have same IP Address. Now many times we want our project must be accessed by offer without authentication.

But some one trying to access the same website from outside of office, It must prompt for password.


In this below code, We are allowing mulitple IP Address for which it will not ask authentication.
Order deny,allow
Deny from all
Allow from "112.xxx.x.xxx|113.xxx.x.xxx|113.xxx.x.xxx"
AuthType Basic
AuthUserFile /opt/.htpasswd
AuthName "Protected Area"
require valid-user
Allow from "112.xxx.x.xxx|113.xxx.x.xxx|113.xxx.x.xxx"
Satisfy Any