URL Generation Configuration for Sections and Elements in 1C-Bitrix
Ugly URLs like /bitrix/components/bitrix/catalog/detail.php?ID=123 or /catalog/index.php?SECTION_ID=45 result from components running without SEF mode (friendly URLs). Configuring URL generation for infoblock sections and elements is one of the first tasks when launching a catalog.
SEF Mode and URL Templates
In Bitrix, "human-readable URLs" are implemented through the SEF (Search Engine Friendly) mode of the component. In SEF mode, the component manages URL routing through rules.
In the bitrix:catalog component parameters (or bitrix:iblock.list), SEF settings are:
$APPLICATION->IncludeComponent('bitrix:catalog', '', [
'SEF_MODE' => 'Y',
'SEF_FOLDER' => '/catalog/', // folder where the component operates
'SEF_URL_TEMPLATES' => [
'list' => '', // /catalog/
'section' => '#SECTION_CODE#/', // /catalog/shoes/
'element' => '#SECTION_CODE#/#ELEMENT_CODE#/', // /catalog/shoes/sneakers/
],
]);
Variables in URL Templates
Available variables for templates:
| Variable | Description | Source |
|---|---|---|
#ELEMENT_ID# |
Element ID | b_iblock_element.ID |
#ELEMENT_CODE# |
Symbolic code | b_iblock_element.CODE |
#SECTION_ID# |
Section ID | b_iblock_section.ID |
#SECTION_CODE# |
Section symbolic code | b_iblock_section.CODE |
#IBLOCK_TYPE_ID# |
Infoblock type | b_iblock.IBLOCK_TYPE_ID |
#IBLOCK_CODE# |
Infoblock symbolic code | b_iblock.CODE |
URL Configuration in Infoblock Settings
Besides component parameters, URL templates are set in infoblock settings:
Content → Infoblocks → [infoblock] → Settings:
-
Detail page URL — template for
DETAIL_PAGE_URL -
List page URL — template for
LIST_PAGE_URL -
Section page URL — template for
SECTION_PAGE_URL
Example: /catalog/#SECTION_CODE#/#ELEMENT_CODE#/
These values are stored in b_iblock.DETAIL_PAGE_URL, b_iblock.SECTION_PAGE_URL and used by CIBlockElement::GetDetailPageUrl methods.
Symbolic Code Generation
The symbolic code (CODE) is important for URLs. Without it, the URL will contain #ELEMENT_ID#. Configure automatic code generation:
Content → Infoblocks → [infoblock] → Fields → Symbolic code:
- Transliterate from — select a field (usually "Name")
- Unique — enable to append suffix on duplication
- Maximum length — recommended 100 characters
When editing an element, the code is generated automatically. For existing elements without code — bulk fill via admin panel (Select all → Set symbolic code).
URL Redirect Rules on Change
When changing an element's symbolic code, the old URL stops working. For SEO, configure 301 redirects. Options:
-
seomodule → "URL for 301 redirects" — stores element URL history inb_seo_url_rewrite - Handler
OnBeforeIBlockElementUpdate— intercept code change and create redirect rule - Manual addition via
Settings → URL redirects
SEF and Friendly URLs for Trade Offers (SKU)
For stores with trade offers, the URL is built from the main product. SKU selection via GET parameter (?sku=123) or via JavaScript when selecting characteristics. Specific SKU typically has no separate URL.
Execution Timeline
Configuring SEF mode, URL templates, and bulk symbolic code generation — 3–5 hours. Configuring 301 redirects for existing elements when changing URL structure — 2–4 hours additional.







