Redirecting to the page and sending custom HTTP headers

I am using the following code to redirect to a page in PHP. I need to configure custom HTTP headers for transmission along with redirection.

header("Location: http://...");

How can I archive this?

+1
source share
3 answers

Multiple header Documents :

header("Location: ....");
header("Header2: ....");
header("Header3: ....");
...
+2
source

I'm afraid all the answers are wrong and misleading!

Cannot be redirected to a page with custom headers, no matter which language or frame you use. In other words, there is no way to trigger an HTTP redirect and force the client (browser) to add a custom header.

, , header() . . , , .

, HTTP- , - Javascript XMLHttpRequest. ajax CORS .

, HTTP-, async, XMLHttpRequest. , .

, .

+8

Just add extra calls header()after or before.

header("Location: http://...");
header("Content-Type: text/plain");
+1
source

Source: https://habr.com/ru/post/1664984/


All Articles