URL rewrites¶
Since 1.5. Entity URL rewrites (openimport_url_rewrite), import and export. A file of old addresses and where
they should go — after a relaunch, a shop migration, a campaign — lands in Magento's URL rewrites (Marketing ›
URL Rewrites): permanent (301) and temporary (302) redirects, or plain rewrites that show another page under the
address. The export writes every rewrite of the shop, Magento's generated ones included, and imports back as it is.
Columns¶
| Column | Required | Meaning |
|---|---|---|
request_path |
yes | The address as the visitor types it, after the store's base URL: old-shirts.html, sale/summer. No spaces, # or //. |
store_code |
no | The store view (default, de); empty: the default store view. A rewrite exists once per request path and store view. |
target_path |
custom | Where it goes: a path of the shop (new-shirts.html, catalog/category/view/id/5) or, for a redirect, a full address (https://example.com/promo). Empty when the row names a product, category or CMS page. |
redirect_type |
no | 301 (permanent), 302 (temporary), or empty/0 for a plain rewrite that shows the target under the request path. Words work too: permanent, temporary. |
product_sku |
no | The product the address belongs to. With a redirect, the target is the product's current URL in that store view (blue-shirt.html); without, its canonical path. |
category_path |
no | The category by path (Default Category/Men/Shirts), same as the category import. |
cms_page |
no | The CMS page by identifier (about-us). |
entity_type |
no | custom, product, category or cms-page; normally left empty, the filled column decides. The export writes it. |
description |
no | A note shown in the admin grid. |
autogenerated, metadata |
no | What the export writes for Magento's generated URLs (1, and the category of a product-in-category URL as JSON). Leave empty in your own files. |
One of product_sku, category_path and cms_page at most; none of them makes a custom rewrite, which needs a
target_path.
What a run does¶
- Every row is checked: the path, the store view, the redirect type, the product/category/page exists, the target is not the request path itself, the same address is not in the file twice. A dry run counts what would be created and updated and names every problem with the row number.
- Add/Update creates a rewrite or updates the one that answers the request path in that store view (target, redirect type, entity, description). Delete removes the rewrites of the file. Replace is refused at save.
- Magento's generated URLs are never changed or deleted. A request path that is the URL Magento generated for another product, category or page is a conflict, reported with the owner: "blue-shirt.html" is the URL Magento generated for product SHIRT-BLUE; it cannot be changed. Magento regenerates those URLs on every save, so a change here would not last; change the product's URL key instead (the product import does that, with a 301 for the old address, see URL keys and redirects).
- Auto-match knows
old URL,new URL,from,to,redirect,SKU,alte URL,neue URL,Weiterleitungand the like.
Sample file:
request_path;target_path;redirect_type;product_sku;description
old-shop/blue-shirt-xl.html;;301;SHIRT-BLUE-XL;Address from the old shop
summer;sale/summer.html;302;;Campaign, remove in September
shirts;catalog/category/view/id/12;;;Short address for the shirts category
Export¶
The export writes every rewrite with the store view code and, for product, category and CMS page rewrites, the SKU,
category path or page identifier instead of Magento's internal ids, so the file is readable and imports into
another store whose ids differ. Filter it in step 3 (for example autogenerated equals 0 for your own rewrites
only, or request_path starts with a prefix).