Back to CMSApplication class

Method redirect

public void
redirect
(mixed $url, mixed $status = 303)
Redirect to another URL.
Parameters
  • string $url The URL to redirect to. Can only be http/https URL
  • int $status The HTTP 1.1 status code to be provided. 303 is assumed by default.
Returns
  • void
Since
  • 3.2

Method redirect - Source code

/**
 * Redirect to another URL.
 *
 * If the headers have not been sent the redirect will be accomplished using a "301 Moved Permanently"
 * or "303 See Other" code in the header pointing to the new location. If the headers have already been
 * sent this will be accomplished using a JavaScript statement.
 *
 * @param   string   $url     The URL to redirect to. Can only be http/https URL
 * @param   integer  $status  The HTTP 1.1 status code to be provided. 303 is assumed by default.
 *
 * @return  void
 *
 * @since   3.2
 */
public function redirect($url, $status = 303)
{
    // Persist messages if they exist.
    if (\count($this->messageQueue)) {
        $this->getSession()->set('application.queue', $this->messageQueue);
    }
    // Hand over processing to the parent now
    parent::redirect($url, $status);
}