1

When I'm importing products or creating categories Magento always automatically generates rewrite urls.

These rewrites are listed at Admin Backend -> Marketing -> URL Rewrites.

The category url I want:

www.example.com/store-view/category-name

What Magento 2 gives me after its autogenerated url rewrite:

www.example.com/store-view/catalog/category/view/s/category-name/id/4/ 

I know that I can get rid of the redirect by deleting it at Admin Backend -> Marketing -> URL Rewrites. However, I have hundreds of categories and thousands of products and there is no batch delete and I don't want to edit the database because this is unsafe and I would have to do it after each product import.

My questions are:
1. Why is Magento generating such wired urls?
2. How can I prevent autogenerated rewrite urls? Can I do this via config.xml or by writing a plugin (At this point of time I don't know the method that is responsible for autogenerating rewrite urls)?

2 Answers 2

1

Facing the same issue, and it looks like this is a known issue within Magento2 and has not been resolved yet https://github.com/magento/magento2/issues/5863

0

Generally magento show the category URL like this.

www.example.com/category-name

If you just want to add store code into URL, then you need to do this.

  1. On the Admin, System > Settings > Configuration.
  2. On the left panel, under General, select Web.
  3. Open the URL Options section.
  4. Choose Yes in the Add Store Code as you need.

After doing this, do caching and then check frontend. It show URL like this.

www.example.com/store-code/category-name
1
  • Thanks for your response, but this does not address my issue.
    – Jens
    Commented Jul 4, 2018 at 16:10

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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