SEO URLs · rule-based, multilingual, reindex-proof
The PIM creates product URLs by fixed rules, per shop and language, for main products and variants. Either you edit the native Shopware URL directly or you use the two-generator system with the full category path.
Two modes: Shopware standard or two-generator system
All settings are in the config matrix, tab "SEO URLs".
Shopware standard SEO URL
With the switch "Use Shopware standard SEO URL" you edit the native Shopware URL per product directly in the PIM, the two generators are then disabled. Two additional switches also show the field in the variant window and in the quickview. The mode is off out of the box.
Two-generator system
- Generate URL in custom field: A token pattern is resolved per variant and language and written into a custom field on the product.
- Generate SEO URLs: A Twig pattern reads this field and is stored as Shopware's SEO URL template for the product detail page.
Step 1: generate URL in custom field
In the field pattern (token) you assemble the path from variables, for example {mainCategoryPath}/{name}. Clicking a variable inserts it at the cursor position. The result is stored in the custom field staw_pim_canonical. If "Custom pattern per shop" is active, the PIM writes into a separate field staw_pim_canonical_<shop> per shop, built from the sales channel name.
- Category path source: SEO main category per channel (default) or first assigned category
- Separator: hyphen (default) or underscore
- Include top category level: default off
- Lowercase and Convert umlauts: default on
- Preview with a sample product, switchable between languages
"Generate URL in custom field" opens a window for choosing shops and languages. For the selected combinations existing values are overwritten, identical values are skipped. For a single product, the button "Generate from pattern" in master data and in the variant window fills the field, then you save as usual. When duplicating, the PIM regenerates custom field and SEO URL for the copy and its variants.
All variables
| Variable | Content |
|---|---|
{name} | Product name |
{number} | Product number |
{manufacturer} | Manufacturer name |
{manufacturerNumber} | Manufacturer number (MPN) |
{ean} | EAN / GTIN |
{metaTitle} | Meta title of the product |
{category} | Name of the first assigned category |
{categoryPath} | Full path of the first category |
{mainCategory} | Name of the main category, depending on the source |
{mainCategoryPath} | Full path of the main category |
{properties} | Property values |
{options} | Variant options |
{tags} | Tags |
Step 2: generate SEO URLs with Twig
The URL pattern (Twig) reads the custom fields. Variable buttons insert ready-made expressions: name, name (lowercase), order number, EAN, manufacturer, manufacturer number, product ID, breadcrumb, breadcrumb without first level, any custom field, canonical field and a condition for migrated URLs:
{% if product.customFields.staw_url_product_detail|default('')|trim %}{{ product.customFields.staw_url_product_detail|raw }}{% else %}{{ product.translated.customFields.staw_pim_canonical|raw }}{% endif %}
Migrated products keep their previous URL this way, new ones use the field from step 1. When generating, the PIM writes the pattern per selected shop as the SEO URL template (seo_url_template) of the product detail page and creates the URLs of the selected shops and languages via Shopware's own SEO generator. Existing product URLs are released for this, changed paths remain as redirects. Because the template is stored in Shopware, a later reindex also creates the same URLs.
- Outputs of fields such as
staw_pim_canonical…orstaw_url_…automatically get|rawso Shopware does not turn the slashes in the path into hyphens. - If the pattern outputs nothing for a product, Shopware uses the product name instead of an empty path.
Pattern editor and shop patterns
Both steps support "Custom pattern per shop". Shop patterns appear as a list with shop name and pattern, you edit them with the pencil and remove them with the bin. "Add pattern for shop" opens the editor with a channel selection. Shops without their own pattern use the default pattern.
- The input field grows with its content, long
{% if %}conditions stay readable. - The variable buttons adapt: tokens for step 1, Twig expressions for step 2.
- A Twig pattern is validated continuously. Errors appear in red, saving is then blocked.
- If tokens such as
{name}appear in a Twig pattern, the editor warns: they are not resolved there.
Generation window and options
Both generators open a window in which you choose shops and languages, grouped by sales channel, with "Select all" globally and per group. Step 2 additionally offers:
- Keep old URLs as 301 (default on): when the path changes, the old URL remains as a redirect.
- Only generate missing SEO URLs (default on): products with an existing URL stay untouched.
- Remove all product URLs (reset) (default off): first deletes all product URLs of the selected channels and languages. The two options above then no longer apply.
- Preview: up to three sample products from the channel with previous and new path.
- Dry run: calculates the run with these options without writing anything.
The three options are evaluated by the dry run and by the console command. The button "Generate SEO URLs" sets the shop template and lets Shopware create the URLs.
Result and conflicts
Dry run and console command report written, unchanged and skipped URLs, redirects and products without a rendered path. If two products resolve to the same path in the same shop and language, the first one wins and the second is listed as a conflict with its product number. If a path is already taken by a category or page, the product is skipped and counted as "path already in use elsewhere".
{mainCategoryPath}/{name}-{options}.Slug rules
- ä, ö, ü and ß become ae, oe, ue and ss if "Convert umlauts" is on. Other special characters are transliterated into Latin letters.
- Everything except letters, digits, slash and dot becomes the separator. Category names with "/" and endings like
.htmlare preserved this way. - Double separators and slashes are merged, separators at the start, at the end and around slashes are removed. An empty
{options}therefore leaves no trailing hyphen. - Fixed text in the pattern, such as "für/", also goes through these rules.
Language fallback
Name, manufacturer, categories, options, properties and meta title come in the language being generated. If a value is missing there, the chain requested language → parent language → system language applies, empty translations are skipped. This way no default language ends up in foreign-language URLs by accident.
Variant URLs
Both steps process main products and variants that are visible in the channel. Variants inherit name, manufacturer, categories, properties, tags and meta title from the main product. {options} returns the variant's own options, so {mainCategoryPath}/{name}-{options} creates a separate URL per variant and language.
Category path
The path uses the SEO main category of the respective channel. If none is set, the PIM uses the deepest assigned category. If the category path maintained by Shopware is missing, for example after an import, it is rebuilt via the parent categories. The top level is left out as long as "Include top category level" is off.
Console command staw:pim:seo:generate
For large catalogues or scheduled runs, the command creates the URLs of a channel directly on the server. It uses the URL pattern from step 2 for this channel, writes the results into the SEO URL table and marks them as manually modified so Shopware's indexer does not overwrite them.
bin/console staw:pim:seo:generate --sales-channel="Storefront" --dry-run
bin/console staw:pim:seo:generate -s "Storefront" --overwrite --keep-modified
| Option | Effect |
|---|---|
--sales-channel, -s | Required: sales channel as hex ID or name |
--language, -l | Language ID as hex, default is the channel's default language |
--dry-run | Simulate only, write nothing |
--no-redirects | Replace old URLs hard instead of keeping them as 301 |
--overwrite | Also rewrite existing URLs, without this option only missing ones |
--keep-modified | Do not overwrite manually modified URLs |
What's next
You create meta titles and descriptions with AI text generation, you assign main categories in category management or via bulk edit. All other tabs are described in the config matrix.
Frequently asked questions
Do the URLs survive a reindex?
Yes. Step 2 stores the pattern as an SEO template in Shopware, so a reindex creates the same URLs. The console command additionally marks its URLs as manually modified.
Are old links lost when paths change?
No. Changed paths remain as redirects. Old URLs are only removed with the option --no-redirects in the console command or with the reset.
What is the difference between {category} and {mainCategory}?
{category} uses the first assigned category, {mainCategory} uses the SEO main category of the channel or, depending on the setting, also the first category. The variants with Path return the full path in each case.
Can I create different URLs per shop?
Yes. With "Custom pattern per shop" you create separate patterns per sales channel for step 1 and step 2. Shops without their own pattern use the default pattern.