Redirect
in package
Redirect and exit
Table of Contents
- goTo() : void
- Redirect to location, sets headers, exit header("Location: ".$strToLocation,TRUE,$nCode)
- getLocation() : string
Methods
goTo()
Redirect to location, sets headers, exit header("Location: ".$strToLocation,TRUE,$nCode)
public
static goTo([string $strToLocation = '' ][, int $nCode = 303 ]) : void
The HTTP status code changes the way browsers and robots handle redirects, so if you are using header(Location:) it's a good idea to set the status code at the same time. Browsers typically re-request a 307 page every time, cache a 302 page for the session, and cache a 301 page for longer, or even indefinitely. Search engines typically transfer "page rank" to the new location for 301 redirects, but not for 302, 303 or 307. If the status code is not specified, header('Location:') defaults to 302. http://www.php.net/manual/de/function.header.php#78470
301 Moved Permanently 302 Moved temporarily / Found 303 See Other 307 Temporary Redirect
Parameters
- $strToLocation : string = ''
-
- the url
- $nCode : int = 303
-
- 301 perm,302 temp,303 see other
Return values
void —getLocation()
private
static getLocation([string $strToLocation = '' ]) : string
Parameters
- $strToLocation : string = ''