Documentation

Redirect

Class \Bitrix\Main\Engine\Response\Redirect.

To execute redirect, it's sufficient to use Response\Redirect. Kernel automatically performs necessary security checks and executes redirect 301 or 302 for.

//redirect with 302 status.
$response = new \Bitrix\Main\Engine\Response\Redirect('/auth');
//redirect with 301 status.
$response = new \Bitrix\Main\Engine\Response\Redirect('/auth');
$response->setStatus('301 Moved Permanently');
Method Description Available from version
__construct(
   $url, 
   bool $skipSecurity = false
)
Constructor method. Parameters:
  • $url {string} - target URL for redirect. Can be relative or absolute.
  • $skipSecurity {bool} - if true, declines security checks. Be default: false.
getUrl(
)
Returns URL for redirect.
setUrl(
   $url)
Sets URL for redirect. Parameters:
  • $url {string}. URL for redirect. Can be relative or absolute.
isSkippedSecurity(): bool
Returns current skipped security checks status during redirect.
setSkipSecurity(
   bool $skipSecurity
)
Sets security status checks. Parameters:
  • $skipSecurity {bool}. If true, disables security checks. If false - enabled.

© «Bitrix24», 2001-2022
Up