简体   繁体   English

PHP标头位置到https

[英]PHP header location to https

In my web app you get redirected after successful login via header('Location: https://domain.com/loggedin') but when its finished redirecting I get to following URL http://domain.com:443/loggedin which give (of course) following error 在我的网络应用中,通过header('Location: https://domain.com/loggedin')成功登录后,您将被重定向,但重定向完成后,我将转到以下URL http://domain.com:443/loggedin (当然)以下错误

400 Bad Request

Your browser sent a request that this server could not understand.
Reason: You're speaking plain HTTP to an SSL-enabled server port.
Instead use the HTTPS scheme to access this URL, please.

What do I have to change? 我必须改变什么? What did I do wrong or what do I have to add? 我做错了什么或必须添加什么?

This sounds absurd but after some thinking: I added a slash ( / ) at the end so now it looks like this header('Location: '.PROJECT_HTTP_ROOT.'/'); 这听起来很荒谬,但是经过一番思考:我在末尾添加了一个斜杠( / ),所以现在看起来像这个header('Location: '.PROJECT_HTTP_ROOT.'/'); .

Works like it should now! 现在就可以正常工作了!

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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