简体   繁体   中英

Php redirect with http authentication

How to redirect to a url and pass through in php the login and password http, ie, the http basic login but without user interference? without login pop-ups !

thanks, celso

Short answer is that you can't.

Redirecting to http://user:pass@example.com/ will work on some browsers but not all.

You could use a substitute authentication module, and push a value into it - eg using mod_authmemcookie on Apache if you're happy to tweak the server config like this (and have a cookie you can use).

don't know if i understood you right, but if you only want to redirect to a http-auth-secured site without the annoying popup, you can sent the username and password in the url:

http://username:password@exapmle.com/adminpanel/

note that, with this solution, the password is readable in the url and some browsers (IE only <=6, this was disabled in the newer versions) don't support this - maybe thats a problem for you. for more information, take a look at this article

With basic auth, the browser will re-send credentials when requested by the server. This only works for the same hostname though.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM