Sometimes you notice the categories can’t be accessed from the Magento 2 website front-end and you realized that this is due to The URL Rewrites Rule for that category being missing at Magento Admin > MARKETING > SEO & Search > URL Rewrites.
There are so many reasons behind this issue, and below are some of those.
– URL rewrites deleted after Magento version upgrade
– Created a new store and categories URL rewrites do not create for that new stores.
– Sometimes mistakenly you removed the URL rewrites rules.
– And so on.
But here we show you how you can easily create the URL rewrites for all the categories without any third party module and without doing any customization.
Below are steps to recreate URL Rewrites for categories and products in Magento 2
Step 1: Log in to the Magento 2 admin and navigate to CATALOG > Categories.
Step 2: Create one temporary root category by clicking on the “Add Root Category” button.
Step 3: Then navigate to STORES > All Stores
Step 4: Edit a store for that you want to regenerate URL Rewrites rules.
Step 5: Then select that temporarily created root category in the “Root Category” and hit Save Store.
Step 6: Again edit that same store and select your original root category in the “Root Category” and hit Save Store.
Saving store settings takes some time according to the number of categories in your store and once it will be finished you can see all URL Rewrites created for all the categories.
Important Note: Keep the below points in mind before you follow the above steps otherwise the URL Rewrite will not get generated.
- Categories and products status should be enabled.
- “Include in Menu” is enabled for all categories.
That’s it, this is all you have to do to recreate the Magento URL Rewrite rules in Magento 2 for existing categories.