2

I am investigating an issue where a category has more than one url rewrites. It looks like this:

mysql> select * from url_rewrite where entity_id = 8597 and entity_type = 'category';
+----------------+-------------+-----------+-----------------------------------+-------------------------------+---------------+----------+-------------+------------------+----------+
| url_rewrite_id | entity_type | entity_id | request_path                      | target_path                   | redirect_type | store_id | description | is_autogenerated | metadata |
+----------------+-------------+-----------+-----------------------------------+-------------------------------+---------------+----------+-------------+------------------+----------+
|         395619 | category    |      8597 | food/yummy/bananas.html           | catalog/category/view/id/8597 |             0 |        2 | NULL        |                1 | NULL     |
|         404017 | category    |      8597 | product/food/bananas.html         | catalog/category/view/id/8597 |             0 |        2 | NULL        |                0 | NULL     |
|         404025 | category    |      8597 | food/good-bananas.html            | catalog/category/view/id/8597 |             0 |        2 | NULL        |                0 | NULL     |
+----------------+-------------+-----------+-----------------------------------+-------------------------------+---------------+----------+-------------+------------------+----------+
3 rows in set (0.12 sec)

The value in the "URL Rewrite" field on the category detail page in Magento Admin matches the value in the autogenerated row.

I wonder what the values 0/1 of is_autogenerated mean. How exactly would I create a "non-autogenerated" url rewrite for a category in Magento2?

2

The url_rewrite table includes all rewrites, including products and rewrites that you created from the admin.

You can create manual rewrites for categories or products from the adminenter image description here so that's why you have that 0 or 1 for categories as well.

See from the admin under Marketing => Seo & Search => Url rewrites

  • Does that mean, that the value for "autogenerated" is always 0 for entity_type category? And we just have a data issue, if I get the above result from this sql statement? – where Oct 23 '18 at 1:24
  • Answer corrected and updated, sorry for confusion – Haim Oct 23 '18 at 2:09

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.