SEO URLs is a URL that is designed to meet the needs of users and searchers. In Shopware 6, SEO URLs are automatically generated based on an “SEO URL template”. You can find the template settings under Settings > Shop> SEO

There are templates for product detail pages, landing pages, and category pages. The product detail page SEO URL template is {{ product.translated.name }}/{{ product.productNumber }}. So a “Main product with advanced prices” with SKU “SWDEMO10002” would get this SEO URL: Main-product-with-advanced-prices/SWDEMO10002.

The SEO URL generated a class called “\Shopware\Core\Content\Seo\SeoUrlGenerator” and stored in the seo_url table. The templates are stored in seo_url_template. This is what the seo_url table looks like in the database.

You have to run this command “bin/console dal:refresh:index” to run the indexer to generate an SEO URL. Make sure you run this command after you’ve changed the template. It does not automatically regenerate the URLs.
Overriding SEO URLs
If you want to override the SEO URL then open a product in the admin and navigate to the SEO option. In the “SEO URLs” section and select your sales channel. You can now set the SEO URL manually under “SEO path”. You can optionally set a “Main Category” here. This value is used in the Category Breadcrumb Builder “\Shopware\Core\Content\Category\Service\CategoryBreadcrumbBuilder“. It will show the chosen main category in the breadcrumbs instead of the first category Shopware finds the product in.
If you manually configured an SEO URL, it will be saved in the seo_url table with the is_modified column value set to 1. This column flags whether an SEO URL has been modified manually. It will prevent the SEO URL generator from overwriting the URL with a generated one “\Shopware\Core\Content\Seo\SeoUrlPersister::skipUpdate“.
Changing the SEO URL template
When you changed the template and run the indexer, Shopware keeps the old URL around to make sure the URLs indexed by search engines keep working. They will now redirect to the new URL. When this happens, the is_canonical column in the seo_url table for the old URL will now be 0
while the is_canonical column for the new URL will be 1.
If you set the is_modified column in the seo_url table is 1, then the old URLs won’t be changed while updating the template and it creates a new URL and assigns it to a new template.
Canonicals
When creating a product, you enter the name “Main product with advanced prices” and an SEO URL “Main-product-with-advanced-prices/SWDEMO10002“. Then you can generate variants, the names will be “Main-product-with-advanced-prices/SWDEMO10002.1“.

Now go to the SEO section of the parent product “Main product with advanced prices” and configure a single canonical URL for all variants. You can only choose one of the variants, and not the SEO URL of the parent.

You can do this by overriding the product-detail/meta.html.twig file to check if a parent is known for the current product, and then retrieve the SEO URL of the parent product to show in the canonical field.
{% sw_extends '@Storefront/storefront/page/product-detail/meta.html.twig' %}
{% block layout_head_canonical %}
{% if page.product.parentId %}
<link rel="canonical" href="{{ seoUrl('frontend.detail.page', { productId: page.product.parentId }) }}" />
{% else %}
<link rel="canonical" href="{{ seoUrl('frontend.detail.page', { productId: page.product.id }) }}" />
{% endif %}
{% endblock %}
Please contact us at manish@bay20.com or call us at +91-8800519180 for any support related to shopware. You can also visit the Shopware SEO page to check the services we offer.