Setting up 301 redirects in 1C-Bitrix

Our company is engaged in the development, support and maintenance of Bitrix and Bitrix24 solutions of any complexity. From simple one-page sites to complex online stores, CRM systems with 1C and telephony integration. The experience of developers is confirmed by certificates from the vendor.
Our competencies:
Development stages
Latest works
  • image_website-b2b-advance_0.png
    B2B ADVANCE company website development
    1175
  • image_bitrix-bitrix-24-1c_fixper_448_0.png
    Website development for FIXPER company
    811
  • image_bitrix-bitrix-24-1c_development_of_an_online_appointment_booking_widget_for_a_medical_center_594_0.webp
    Development based on Bitrix, Bitrix24, 1C for the company Development of an Online Appointment Booking Widget for a Medical Center
    564
  • image_bitrix-bitrix-24-1c_mirsanbel_458_0.webp
    Development based on 1C Enterprise for MIRSANBEL
    747
  • image_crm_dolbimby_434_0.webp
    Website development on CRM Bitrix24 for DOLBIMBY
    655
  • image_crm_technotorgcomplex_453_0.webp
    Development based on Bitrix24 for the company TECHNOTORGKOMPLEKS
    976

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',
    ]);
}

CURLRewritemain 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.