AI Reports

Guides › Database reference › URLs and configuration

Magento 2 url_rewrite table

Every search-engine-friendly URL on the storefront and what it points to: products, categories, CMS pages and custom redirects.

Key columns

ColumnWhat it means
entity_typeproduct, category, cms-page or custom.
entity_idThe product, category or page ID.
request_pathThe URL people see, such as men/jackets.html.
target_pathWhere it goes: an internal path such as catalog/product/view/id/42, or another URL for a redirect.
redirect_type0 = no redirect, 301 = permanent, 302 = temporary.
store_idThe store view.
is_autogenerated1 = made by Magento, 0 = added by hand.

Good to know

Example: Number of URLs per store view and type

Works on Magento Open Source and Adobe Commerce.

SELECT store_id, entity_type, COUNT(*) AS urls, SUM(redirect_type > 0) AS redirects
FROM url_rewrite
GROUP BY store_id, entity_type
ORDER BY store_id, entity_type;

Tested on Magento Open Source and Adobe Commerce 2.4.8. Read-only. If your tables have a prefix, add it to each table name.

This table has the same 10 columns on Magento Open Source and Adobe Commerce.

All 10 columns (Magento Open Source)

Show all columns
ColumnTypeCan be emptyMagento's description
url_rewrite_idint(10) unsignedRewrite ID
entity_typevarchar(32)Entity type code
entity_idint(10) unsignedEntity ID
request_pathvarchar(255)yesRequest Path
target_pathvarchar(255)yesTarget Path
redirect_typesmallint(5) unsignedRedirect Type
store_idsmallint(5) unsignedStore ID
descriptionvarchar(255)yesDescription
is_autogeneratedsmallint(5) unsignedIs rewrite generated automatically flag
metadatavarchar(255)yesMeta data for url rewrite

Related tables

Gaurav Harsh

Gaurav Harsh is a Magento developer who works on large Adobe Commerce stores and builds AI Reports, a Magento extension for asking your store's data questions in plain English. LinkedIn