Setting up multi-domain configuration in 1C-Bitrix
Multi-domain configuration — this is when one Bitrix site is accessible through multiple domain names. Not to be confused with multi-site functionality: there different sites (different content, templates), here — one site, multiple entry points. Typical scenarios: example.com and www.example.com, regional domains example.ru / example.by / example.kz with unified content, or migration from old domain to new with both working.
The problem that multi-domain setup solves
Without proper setup, Bitrix accessing via "unknown" domain either gives 404 or works with errors: links generated with wrong domain, authorization fails due to cookie domain mismatch, sitemap contains old domain URL, and canonical points wrong. Each of these issues hurts SEO and user experience.
Setup at Bitrix level
Main domain is set in site settings: Settings → Product settings → Sites → SERVER_NAME field. This is the domain Bitrix uses to generate absolute URLs — in emails, sitemap, og:url etc.
Additional domains Bitrix doesn't store by itself. The system determines site by SERVER_NAME from HTTP header Host. If incoming Host doesn't match any site — default site is selected. This works, but without explicit control.
For explicit management use urlrewrite.php or init.php file:
// /local/php_interface/init.php
$host = $_SERVER['HTTP_HOST'] ?? '';
$domainMap = [
'example.ru' => 's1',
'example.by' => 's1',
'example.kz' => 's1',
'www.example.ru' => 's1',
];
if (isset($domainMap[$host])) {
define('SITE_ID', $domainMap[$host]);
}
Setup at web server level
Each domain needs a separate server block (nginx) or VirtualHost (Apache), pointing to same DOCUMENT_ROOT.
Nginx:
server {
server_name example.ru example.by example.kz www.example.ru;
root /home/bitrix/www;
include /etc/nginx/conf.d/bitrix.conf;
}
Redirects — mandatory. Without canonical redirect, search engines index duplicates. Standard scheme:
-
www.example.ru→ 301 →example.ru(or vice versa — choose one variant) -
http://→ 301 →https:// - Regional domains — either 301 to main, or hreflang markup
SSL certificates
Each domain requires valid SSL. Options:
-
Wildcard certificate
*.example.ru— covers subdomains, but notexample.by -
SAN certificate (Subject Alternative Name) — one certificate for multiple domains. Let's Encrypt supports up to 100 SAN via
certbot --domains example.ru,example.by,example.kz - Separate certificates — if domains are in different zones, easier to manage
Cookie and authorization
Critical point: PHPSESSID cookie and Bitrix authorization cookies (BITRIX_SM_LOGIN, BITRIX_SM_UIDH) are bound to domain. User authorized on example.ru won't be authorized on example.by.
If you need cross-domain authorization — this is separate task solved via SSO module or token mechanism with redirect. For most multi-domain configurations (redirect / mirrors) this isn't needed — 301 to canonical domain is sufficient.
Checklist after setup
-
SERVER_NAMEin site settings matches main domain - All non-main domains have 301 redirect to canonical
- SSL valid for all domains
-
canonicalon pages points to main domain - Sitemap contains URLs only of main domain
- Mail notifications contain correct links (check with test order)
Setup takes about one working day, including web server configuration and redirect testing.







