After migration by using ubertheme, my category url is not working. Its showing all category urls are like below http://domain.com/catalog/category/view/s/trouvez-le-fauteuil-ou-canape-chesterfield-fait-pour-vous/id/51/

Can you pleas help me how can i change it to seo format?

I have tried reindexing via ssh and also enable seo url for category and product from Configuration/catalog/SEO tab.

I am using magento 2.1.0

Thanks in advance.

3 Answers 3


Download "Regenerate Url rewrites" extension from here : https://github.com/olegkoval/magento2-regenerate_url_rewrites

Follow the below steps


  1. Extract files from an archive

  2. Create a app/code/OlegKoval/RegenerateUrlRewrites folder in magento root directory, and copy the extracted files from Step1 folder and upload it to directory app/code/OlegKoval/RegenerateUrlRewrites

  3. Disable the cache under System > Tools > Cache Management

  4. Enter the following at the command line

php bin/magento module:enable OlegKoval_RegenerateUrlRewrites

php bin/magento setup:upgrade

php bin/magento setup:static-content:deploy


To re-generate all Url rewrites of the categories/products in all stores (it support a multistores) run

php bin/magento ok:urlrewrites:regenerate

To regenerate all Url rewrites of the categories/products in the specific store view (e.g.: store view id is "2")

php bin/magento ok:urlrewrites:regenerate 2

  • use that but still my categories are redirecting to 404 error .
    – Flutterer
    Commented Oct 1, 2018 at 5:59
  • That worked for me on Magento 2.3.2 Community, also solved other issues with not being able to add items to Cart or Sign in.
    – Maciek Rek
    Commented Dec 6, 2019 at 19:59

Followup of @chris

Incase you, like me, have gotten the task to save a shop which has migrated their store completely wrong here's a functioning script which takes a categoryId and attempt to recreate the category url_rewrite from the category request path to magento's internal mapping of category id.

You can use this in combination with Magento\Catalog\Model\ResourceModel\Category\Collection to walk through every category in your store

This is a function taken from a console command i made to walk the entire store ( https://devdocs.magento.com/guides/v2.4/extension-dev-guide/cli-cmds/cli-howto.html )

$this->output is just the OutputInterface $this->storeId is the current store you which to use.

    public function handleRedirect($categoryId)
        try {
// use Magento\Catalog\Api\CategoryRepositoryInterface;
            /** @var Category $category */
            $category = $this->categoryRepository->get($categoryId);
// use Magento\CatalogUrlRewrite\Model\CategoryUrlPathGenerator;
            $requestPath = $this->categoryUrlPathGenerator->getUrlPath($category);

            $this->output->writeln('<info>Processing: ' . $category->getName() . '</info>');
            $this->output->writeln('<comment>' . $requestPath . '</comment>');

// use Magento\UrlRewrite\Model\UrlRewriteFactory; 
            /** @var \Magento\UrlRewrite\Model\UrlRewrite $rewrite */
            $rewrite = $this->urlRewriteFactory->create();

            $rewrite->setTargetPath('catalog/category/view/id/' . $category->getId());
            $rewrite->setDescription('Category Regeneration');

// use Magento\UrlRewrite\Model\ResourceModel\UrlRewrite

        } catch (\Magento\Framework\Exception\AlreadyExistsException $e) {
            $this->output->writeln('<error>' . $e->getMessage() . '</error>');

This method is non-destructive as it does not duplicate existing urls and only helps fill out the void that some poor soul has created when migrating categories incorrectly :(

Before attempting it check you link, if it's somewhere along the lines of catalog/category/view/id/<id> you can manually create a url_rewrite in the backend ( select category and pick your category ) you can then create it and test it before running the script


This might happen because there is no URL rewrite in Magento. Check your URL rewrites, if that category doesn't exist then create it. In Marketing > URL re-writes > Add URL re-write:

Add new URL rewrite

Flush cache, reindex the site and try again.

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.