tags:

views:

802

answers:

2

I am trying to make a php login page that allows users to access multiple .htaccess protected pages (on apache server). So a user would enter a password in a form on page 1 and depending on which login they provided, they would be sent to one directory or another, but I want the login to happen automatically to the subsequent pages (login is only required on page 1). How does one go about auto logging into an htaccess page if the proper credentials are provided on a referring page? I don't want to append credentials in the url ?user=user&pass=pass

A: 

If the other pages are in the same directory or below most browsers will keep sending the same credentials for subsequent requests if you have the same .htaccess-rules for all the files/directories.

Another alternative to passing ?user=user&pass=pass would be to use POST instead of GET to sendt this request (if you are passing on from a form that is).

Francis Rath
"sending the same credentials for subsequent requests"this would necessitate adding both user and pass combinations to the top level directory so that either one works for top level and redirect happens afterwards. The client requested that we not do that. I thought only GET was acceptable??
sean smith
+1  A: 

If you use multiple .htaccess files be sure to set the AuthName the same. This tells the browser that the same cached uid/password should be provided for that "Realm".

Chris Nava