301 Redirect Setup for Bitrix CMS
301 redirect tells search engine: "Page moved permanently, transfer all link weight to new URL". Without it, when URL structure or domain changes, accumulated positions are lost. In Bitrix, redirects can be configured at several levels — choice depends on task.
Site Management Module — Redirects
Built-in tool: Settings → Product Settings → URLs. Configures redirect from http to https and from www to without www (or vice versa). These are most critical redirects — protocol and subdomain duplication. Bitrix does this via CMain::Redirect() in prolog.
SEO Module — Redirect Management
Path: Marketing → Search Engine Optimization → Redirects. Allows adding redirect rules with patterns. Supports regular expressions.
Example: when changing catalog structure, need to redirect /old-catalog/product-123/ to /catalog/category/product-123/. Add rule:
| Field | Value |
|---|---|
| Source (regex) | ^/old-catalog/(.+)/$ |
| Destination | /catalog/category/$1/ |
| Type | 301 |
Rules checked in priority order. With many rules (100+), enable rule caching in module settings.
Redirects via .htaccess (Apache)
For mass redirects or when maximum performance needed (redirect at web server level, before PHP execution):
# Redirect old section to new
Redirect 301 /old-section/ /new-section/
# Regex redirect
RewriteRule ^old-catalog/(.*)$ /catalog/$1 [R=301,L]
.htaccess file located in site root. Changes apply immediately without Apache restart.
Redirects via nginx
For projects with nginx, it's more efficient to put redirects in server config, not .htaccess:
# In server {} block
location ~ ^/old-catalog/(.+)$ {
return 301 /catalog/$1;
}
# Mass redirects via map
map $request_uri $new_uri {
/old-page-1/ /new-page-1/;
/old-page-2/ /new-page-2/;
default '';
}
if ($new_uri) {
return 301 $new_uri;
}
nginx config applies after nginx -s reload. For managing redirects from Bitrix admin panel, nginx config not suitable — requires server access.
Typical Task: Changing Infoblock SEF URL
When changing infoblock element URL template, old URLs stop working. Must add redirect rules by pattern. If old URL had ID (/catalog/element-123.html) and new one has symbolic code (/catalog/element-code/), separate entry created in SEO module for each element.
Mass redirect addition when changing SEF URL via script:
$res = \CIBlockElement::GetList([], ['IBLOCK_ID' => 5], false, false, ['ID', 'CODE']);
while ($el = $res->Fetch()) {
\CURLRewrite::Add([
'SITE_ID' => 's1',
'SORT' => 100,
'CONDITION'=> '^/catalog/element-' . $el['ID'] . '\.html$',
'RULE' => '/catalog/' . $el['CODE'] . '/',
'TYPE' => '301',
]);
}
CURLRewrite — main module class for programmatic redirect rule management, stored in b_url_rewrite table.
Implementation Timeline
Basic redirect setup (http→https, www) — 30 minutes. Developing and applying mass redirects when changing URL structure — 2–4 hours.







