Bitrix Site Manager

CMainPage::RedirectToSite

mixed
CMainPage::RedirectToSite(
 string site_id
)

The method RedirectToSite redirects to the index page.

Parameters

ParameterDescription
site_id Site ID.

See Also

Example


Note!
If you intend to use the below example as the index page, please ensure:
1. Your sites use method 1 to make multiple sites environment.
2. None of sites has a value of "/" in the field Site Folder. It means that the root of a site is a separate subdirectory.

<?
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");?>