开发者

Php redirect with http authentication

开发者 https://www.devze.com 2023-04-12 04:13 出处:网络
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? 开发者_如何学JAVAwithout login pop-ups !

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? 开发者_如何学JAVAwithout 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 - e.g. 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.

0

精彩评论

暂无评论...
验证码 换一张
取 消