Htaccess auto login - multiple secure dirs accessible from a single login

I am trying to create a php login page that allows users to access multiple secured .htaccess pages (on an Apache server). So the user enters the password in the form on page 1 and depending on what login they provided, they will be sent to one directory or another, but I want the login to be automatically included on subsequent pages (login is only required on page 1). How to make automatic logging on htaccess page when corresponding credentials are provided on the referenced page? I don't want to add credentials to url? User = user & pass = pass

0


source to share


2 answers


If you are using multiple .htaccess files, be sure to set AuthName the same. This tells the browser that the same cached uid / password must be provided for this "kingdom".



+1


source


If other pages are in the same directory or below most browsers, they will send the same credentials for subsequent requests, as long as you have the same .htaccess rules for all files / directories.



Another alternative to passing: user = user & pass = pass will use POST instead of GET to send this request (if you are navigating from a form).

0


source







All Articles