bradcis Posted November 28, 2009 Share Posted November 28, 2009 I have been looking around for this but haven't found a solution. This is what I want to do. I want to setup a directory so that it will check if it matches my IP, if it does match my IP (the one inside .htaccess), then it will let me see the directory contents. However, if it doesn't match my IP, then (and only then) I want it to display the HTTP Authentication popup box. The purpose of this is for me to be able to skip the login step if it someone is visiting from an authorized IP, otherwise, they will need to login to see the directory. I know this can probably be done with PHP and such fairly easily, but I was really hoping to do this all through .htaccess. I plan on having wordpress, media wiki, a bug tracker, etc. in this directory (or sub directories of), so doing this with anything other than server configuration files would be painful. Do you have any suggestions on how to go about doing this? Thank you much in advance. Brad Quote Link to comment Share on other sites More sharing options...
bradcis Posted December 2, 2009 Author Share Posted December 2, 2009 Is this something that can even be done? If not, I will definitely look for an alternative solution. Thank you for your help =) Quote Link to comment Share on other sites More sharing options...
steviewdr Posted December 2, 2009 Share Posted December 2, 2009 It can be done with ldap auth and password auth. I took a look, at your query: limit by ip and password auth. I think there might be a way, but not easy. It would involve a regex match. I.E. if !IP then password auth. There are still issues with that however. You could always do: /var/www/website Create a symlink from /var/www/website to /var/www/website-ip Then put in a rewrite rule based on IP. So anyone coming from the IP will be passed into the /var/www/website-ip directory, and as a result not have to enter a password. Thats the method Id go with, on linux. -steve Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.