Pregunta

I have a server which I would like only accessible via my IP address AND require authentication (either HTTP or PHP) for any users outside the IP address.

My current .htaccess file looks like this:

order deny,allow
deny from all
allow from 12.345.67.78

Any ideas on how to require some sort of authentication for users outside of home IP?

¿Fue útil?

Solución

You can use mod_setenvif in conjunction with mod_auth.

SetEnvIf Remote_Addr ^12\.345\.67\.78$ ALLOWED

AuthType Basic
AuthName "My Protected Area"
AuthUserFile /full/path/to/passwords
Require valid-user
Satisfy    any
Order      deny,allow
Deny from  all
Allow from env=ALLOWED
Licenciado bajo: CC-BY-SA con atribución
No afiliado a StackOverflow
scroll top