HTTP2::redirect – redirects the client


require_once 'HTTP2.php';

void HTTP2::redirect ( string url )


This function redirects the client. This is done by issuing a Location: header and exiting.


Redirecting to another site

require_once 'HTTP2.php';
$http = new HTTP2();

Local redirect

require_once 'HTTP.php';
$http = new HTTP2();

This will redirect the client to /foo.php. The method will take care of adding the right hostname as required by RFC 2616.


  • string $url - the new URL, where to client should be redirected to.


This function can not be called statically.

Avoid sending any kind of data to the client before calling redirect().

The location header requires an absolute URL. If not given, redirect() tries to build one from $url. So if the redirect fails, set the absolute URL manually as argument.

Parse HTTP Web Linking header values (Previous) HTTP_Client (Next)
Last updated: Sat, 16 Feb 2019 — Download Documentation
Do you think that something on this page is wrong? Please file a bug report.
View this page in:
  • English

User Notes:

There are no user contributed notes for this page.