Magento2: Category URL rewrites not generated for new stores

Created on 14 Aug 2018  路  11Comments  路  Source: magento/magento2


When a new website/store is created URL rewrites are only generated for the new store if a category's url_key is updated.
There doesn't appear to be any mechanism to re-generate these URL rewrites for a store, and they also don't take into account any changes to the "catalog/seo/category_url_suffix" configuration value.

Preconditions

  1. Magento 2.2.5
  2. PHP 7.1.20
  3. MySQL 5.7.23

Steps to reproduce

  1. composer create-project --repository-url=https://repo.magento.com/ magento/project-community-edition {install dir}
  2. cd {install dir}
  3. ./bin/magento setup:install --backend-frontname=? --db-host=? --db-name=? --db-user=? --db-password=? --base-url=? --admin-user=? --admin-password=? --admin-email=? --admin-firstname=? --admin-lastname=?
  4. ./bin/magento sampledata:deploy
  5. ./bin/magento setup:upgrade
  6. Visit the admin panel and create a new website, store and store view using the same root category as the default store.

Expected result


Visiting category URLs on the frontend of the new store should match the URLs on the frontend of the default store.
Also, entries for the now store should exist in the url_rewrite table.

Actual result


URLs for the new store are in the format "/catalog/category/view/s/{url_key}/id/{category_id}/" while the default store has the expected URL format.
Also, no entries for the new store exist in the url_rewrite table and there doesn't appear to be any way to generate these short of updating the URL key for each category.

CatalogUrlRewrite Cannot Reproduce Clear Description Confirmed Format is valid Ready for Work Reproduced on 2.2.x

Most helpful comment

I am still facing this issue for categories on Magento 2.3.1. Categories URLs are generated correctly for the default store but not for the new store.

All 11 comments

Hi @simonworkhouse. Thank you for your report.
To help us process this issue please make sure that you provided the following information:

  • [ ] Summary of the issue
  • [ ] Information on your environment
  • [ ] Steps to reproduce
  • [ ] Expected and actual results

Please make sure that the issue is reproducible on the vanilla Magento instance following Steps to reproduce. To deploy vanilla Magento instance on our environment, please, add a comment to the issue:

@magento-engcom-team give me {$VERSION} instance

where {$VERSION} is version tags (starting from 2.2.0+) or develop branches (2.2-develop +).
For more details, please, review the Magento Contributor Assistant documentation.

@simonworkhouse do you confirm that you was able to reproduce the issue on vanilla Magento instance following steps to reproduce?

  • [ ] yes
  • [ ] no

@simonworkhouse, thank you for your report.
We've acknowledged the issue and added to our backlog.

Hi @dimasalamatov. Thank you for working on this issue.
Looks like this issue is already verified and confirmed. But if your want to validate it one more time, please, go though the following instruction:

  • [ ] 1. Add/Edit Component: XXXXX label(s) to the ticket, indicating the components it may be related to.
  • [ ] 2. Verify that the issue is reproducible on 2.3-develop branch

    Details- Add the comment @magento-engcom-team give me 2.3-develop instance to deploy test instance on Magento infrastructure.
    - If the issue is reproducible on 2.3-develop branch, please, add the label Reproduced on 2.3.x.
    - If the issue is not reproducible, add your comment that issue is not reproducible and close the issue and _stop verification process here_!

  • [ ] 3. Verify that the issue is reproducible on 2.2-develop branch.

    Details- Add the comment @magento-engcom-team give me 2.2-develop instance to deploy test instance on Magento infrastructure.
    - If the issue is reproducible on 2.2-develop branch, please add the label Reproduced on 2.2.x

  • [ ] 4. If the issue is not relevant or is not reproducible any more, feel free to close it.

@magento-engcom-team give me 2.3-develop instance

Hi @dimasalamatov. Thank you for your request. I'm working on Magento 2.3-develop instance for you

Hi @dimasalamatov, here is your Magento instance.
Admin access: http://ec2-34-228-235-121.compute-1.amazonaws.com/i-17583-2-3-develop//admin
Login: admin Password: 123123q
Instance will be terminated in up to 3 hours.

I am still facing this issue for categories on Magento 2.3.1. Categories URLs are generated correctly for the default store but not for the new store.

Hi @simonworkhouse.

Thank you for your report and collaboration!

The related internal Jira ticket MAGETWO-94748 was closed as non-reproducible in 2.3.x.
It means that Magento team either unable to reproduce this issue using provided _Steps to Reproduce_ from the _Description section_ on clean or the issue has been already fixed in the scope of other tasks.

But if you still run into this problem please update or provide additional information/steps/preconditions in the _Description section_ and reopen this issue.

I also have the same issue with one of my project. In my case my store has around 700k products, around 250 categories, and more than 5 stores.

When I am adding a new store in admin, the store created with an exception after a long processing. And when i watched in DB there were some url_rewrite table queries executing and stopped after exception occurred. And when i checked url rewrite table there are only few rewrites there.

I guess it is due to large catalog. And url_rewrite is generated at the same time when store is being created for the first time.

I think rewrite entry process should be implemented via corn job.

It does not reproduce in version 2.3 and the ISSUE is closed?
There is no solution for version 2.2?

Related issue https://github.com/magento/magento2/issues/28197 (concerning API)

I can confirm in 2.4-develop that URL rewrites are created for existing categories when a new store view is created.

Was this page helpful?
0 / 5 - 0 ratings