Documentation

RedirectToSite

mixed
CMainPage::RedirectToSite(
 string site
)

The method redirects to the index page. Non-static method.

Function parameters

ParameterDescription
site Site ID.

Example of index page

If you intend to use the below example as the index page, please ensure:
1. Your sites use "Mode 1. Single web server for all sites" to make multiple sites environment.
2. None of sites has a value of "/" in the field Site Folder.

<?
require($_SERVER['DOCUMENT_ROOT']."/bitrix/modules/main/include/mainpage.php");

if ($sid = CMainPage::GetSiteByAcceptLanguage())
    CMainPage::RedirectToSite($sid);

require($_SERVER['DOCUMENT_ROOT']."/bitrix/header.php");?>
<?require($_SERVER['DOCUMENT_ROOT']."/bitrix/footer.php");?>


© «Bitrix24», 2001-2022
Up