Configuring Separate Templates for Multiple Sites in 1C-Bitrix
In a multisite 1C-Bitrix setup, several sites share a single installation — common database, common catalog, but different front-end appearances. The goal is to give each site its own template without duplicating shared logic.
Template Structure in a Multisite Setup
1C-Bitrix stores templates in /bitrix/templates/ (system) and /local/templates/ (custom). Each site's default template is set in the admin panel: Settings → Sites → Site List → {Site} → Site Template.
Recommended structure for multiple sites:
/local/templates/
base/ # Shared base template (layout, header, footer)
site_retail/ # Retail site template
site_wholesale/ # Wholesale site template
site_mobile/ # Mobile version (if not using responsive design)
Template inheritance. 1C-Bitrix does not support template inheritance natively, but it can be emulated using symlinks or includes:
// /local/templates/site_retail/header.php
// Include the shared header and override only what's needed
define('TEMPLATE_BASE_PATH', $_SERVER['DOCUMENT_ROOT'] . '/local/templates/base/');
include TEMPLATE_BASE_PATH . 'header.php';
Binding Components to a Template
Each component can use a different template per site. Component templates are resolved in this order:
-
/local/templates/{site_template}/components/{namespace}/{component}/{template}/ -
/local/components/{namespace}/{component}/templates/{template}/ -
/bitrix/templates/{site_template}/components/... -
/bitrix/components/{namespace}/{component}/templates/{template}/
This means: to give the retail site its own product card, simply create /local/templates/site_retail/components/bitrix/catalog.element/.default/template.php.
Practical Considerations
CSS and JS assets. Each template has its own style.css and script.js in its root directory — 1C-Bitrix includes them automatically. When building with Vite or Webpack, configure publicPath per template.
Detecting the current site in code:
// Get the current site ID
$siteId = \Bitrix\Main\Context::getCurrent()->getSite(); // 's1', 's2', etc.
// In components and templates — global constant
define('SITE_ID', $siteId);
// Conditional rendering in template
if (SITE_ID === 's2') {
// Logic for the wholesale site
}
Language files. Template-specific translations are stored in /local/templates/{template}/lang/{lang}/. 1C-Bitrix loads them automatically when GetMessage() is used.
Timeline
| Configuration | Timeline |
|---|---|
| Setting up 2 templates (basic structure) | 1–2 days |
| Migrating an existing design into multisite structure | 2–4 days |
| Building templates from scratch for 2–3 sites | 5–10 days |







