Hi there,
we have two questions:
1. our url structure is different then the native magento 2.0 category url structure:
We need to have flat category urls for SEO and usability reasons:
Main category url:
url1
Sub category url:
sub1
Sub Sub category url:
sub2
The native magento 2.0 behavior of handling urls for subcategories is:
Main category url:
url1
Sub category url:
url1/sub2
Sub Sub category url:
url1/sub2/sub2
How can we "flatten" the category urls?
My second question is how we can reindex the url rewrites completely to build them up new. I am asking because we migrate our shop at the moment from 1.7 to 2.0 and there are thousand of useless url rewrites imported in the new 2.0 database. What works for example it to delete all category url rewrites in the url_rewrite table and then save the main categories again - then all rewrites are recreated. But how about products etc? Can we reindex them using a special command?
Many thanks!
anybody here?
As far as I know, core url rewrite rules will automatically be re-created if you empty the url_rewrite table and reindex. Custom urls, however, will be lost and must be re-created manually. As for your question on flat category urls, I am not aware of any built-in functionality that will let you do this. You should be able to accomplish something like this by creating a few custom mod_rewrite rules, though.
"anybody here?" - Sorry, I was traveling most of the week, traveling again next week. I will do my best to get to architectural questions here, but it as reliable as me. That is, at times not very reliable! I will try to get back soon.
I'm also interested in this, as I need non nested urls for all our categories.
Thanks!
HI Allen,
when is soon? ;-)
Url rewrites are not recreated with a re-index. People are asking for this and the response was basically we tracked this internally on our secret JIRA and decided it was not a bug, someone has written a plugin that use magento cli as entrypoint that you find attached to one of the many closed github issues (sorry no link at hand), but agreed rebuilding url-rewrite urls should be built in.