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
| Column | What it means |
|---|---|
entity_type | product, category, cms-page or custom. |
entity_id | The product, category or page ID. |
request_path | The URL people see, such as men/jackets.html. |
target_path | Where it goes: an internal path such as catalog/product/view/id/42, or another URL for a redirect. |
redirect_type | 0 = no redirect, 301 = permanent, 302 = temporary. |
store_id | The store view. |
is_autogenerated | 1 = made by Magento, 0 = added by hand. |
Good to know
- A product without a URL rewrite for a store view can still be reached at its internal path, but not at a friendly URL.
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
| Column | Type | Can be empty | Magento's description |
|---|---|---|---|
url_rewrite_id | int(10) unsigned | Rewrite ID | |
entity_type | varchar(32) | Entity type code | |
entity_id | int(10) unsigned | Entity ID | |
request_path | varchar(255) | yes | Request Path |
target_path | varchar(255) | yes | Target Path |
redirect_type | smallint(5) unsigned | Redirect Type | |
store_id | smallint(5) unsigned | Store ID | |
description | varchar(255) | yes | Description |
is_autogenerated | smallint(5) unsigned | Is rewrite generated automatically flag | |
metadata | varchar(255) | yes | Meta data for url rewrite |