Documentation

LocalRedirect

LocalRedirect(
 string url,
 bool skip_security_check=false,
 string status="302 Found"
);

The function performs the client browser redirect to the specified page.

Note. In the administrative section, browser redirects can only be used before any content is outputted (before inclusion of prolog_admin_after.php or prolog_admin.php files). The public section does not apply restrictions on redirects.


Function parameters

ParameterDescription Available from version
urlThe URL to which the browser is to be redirected. Both relative and absolute URLs are accepted in this parameter. Absolute and relative URLs should be having one of the following protocols: "http://", "https://", "ftp://".
skip_security_checkOptional. True allows to skip module phishing security check.
statusOptional. The parameter specifies code (status) in the HTTP-header of the reply. For example, "301 Moved permanently". Parameter is added in the version 8.5.1.8.5.1

Events

OnBeforeLocalRedirect - occurs before redirect; url is passed into the handler.

ParameterDescription Available from version
urlThe URL to which the browser is to be redirected. Both relative and absolute URLs are accepted in this parameter. Absolute and relative URLs should be having one of the following protocols: "http://", "https://", "ftp://".
skip_security_checkOptional. True allows to skip module phishing security check.
bExternalAttribute that specfies passing of a full of relative path.

OnLocalRedirect - occurs during the redirect after the 'Location' header is defined. None of the parameters are not returned into the handler. Available from version 6.5.4.


Examples of use

<?
// full URL to the other site
LocalRedirect("http://www.bitrix24.com/");

// relative path from the root of current site
LocalRedirect("/com/index.php");

// relative path to the file in current directory of current site
LocalRedirect("index.php");
?>


© «Bitrix24», 2001-2022
Up