문제

I have recently created 2 additional store view on magento 2 store. Now the url of category and Products are not for those stores is not proper

Eg: http://example.com/catalog/category/view/s/pouches/id/20/ which is suppose to be http://example.com/accessories/pouches.html

Now when I save each product and category one by one it regenerate url rewrite for that product or category.

But there are lots of products and category.

So is there any way to regenerate URL rewrite

as in Magento 1.x it can be done via reindexing.

도움이 되었습니까?

해결책

This module is been deprecated you can use this module instead

Download Using Composer;

composer require elgentos/regenerate-catalog-urls

php bin/magento setup:upgrade

Regenerate url for all products and the global store

php bin/magento regenerate:product:url

Regenerate url for products with id (1, 2, 3, 4) for store 1

php bin/magento regenerate:product:url -s1 1 2 3 4

다른 팁

You can use Regenerate a Url rewrites extension (it allow to regenerate a Url rewrites of products and categories) .

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

$> bin/magento ok:urlrewrites:regenerate

To regenerate Url rewrites in the specific store view (e.g.: store view id is "2"):

$> bin/magento ok:urlrewrites:regenerate 2

There is actually an easy way to fix this without a lot of trouble. For the TL:DR people, the bold parts are relevant.

One thing to check first; if you have multiple store views, go into the product and switch the view to particular view. Scroll down and make sure the URL-Key is set to "Use Default Value". If that isn't checked, it will never generate. I think this can happen when you import M1 products. I had 200+ products that needed touched up.

This fix also helps if you do the trick where you switch your store to a different root and back, which cleans out everything. Including your custom ones. And it can finish with nothing but the category URL's. Not sure why the URL generation for products fails completely but I think it's because Magento is trying to make too many links in one operation which fails.

So give this a shot. Open the URL rewrite window and note the number of entries. This let's you know if it works.

Go into a first level category (it doesn't work on default because is doesn't have a URL key). Scroll down to Search Engine Optimization / URL-Key. Add an X to the end of the key. Uncheck the "Create Permanent Redirect for old URL", it only adds more work to the operation. Save your category.

Repeat the operation and remove the X, again uncheck the "Create Permanent Redirect for old URL", because you don't need those old URL's clogging up the table. Save again.

Refresh the URL rewrite page and you should see a new number, and shiny new URL's.

Repeat as needed.

FYI really big categories may time out. So in those cases, do the smaller sub-categories by themselves. On my server that threshold is about 400 entries.

Magento is smart enough to make the links for the category above your sub-categories. It is also smart enough that when it see's a product in another category, it builds the links for there too.

Took me a while to figure out why I was seeing fewer and fewer links added as I went down the category list. It was because a majority of products were already in the table and just the stragglers that hadn't appears before remained.

In update to @mahendra Jella's answer, Try this branch of the same extension: https://github.com/PascalBrouwers/magento2-regenurl/tree/feature/generate_category

This one can regenerate URLs for categories too.

The command goes as follows:

php bin/magento iazel:regenurl
# Regenrate Category URL keys >
php bin/magento iazel:regenerate_urls

So, I had this issue for products and fixed this by using the mass update feature to remove all products from the store and then re-adding them. I didn't have very many categories, so I just went in and re-saved them.

Overall, I think avoiding the ole' truncate and regenerate tactic we did in Magento 1 is probably best. If your product rewrites look wrong, just do what I posted above and that should correct them.

As per I know Magento 2 does not provide this feature, but I am using this extension

http://shreejiinfosys.co.in/url-rewrite-generator-magento-2.html

from this I can able to regenerate category and all product url.

Note: I am not promoting the extension hence I am using this extension and its quite useful for me.

Unfortunately none of these extensions/modules have worked for me. I have about 4000 products and moving from Magento 1.9.2.4 to 2.2.2. I used the Data Migration tool and it worked like a charm, other than this issue.

Some of my products have url keys and some do not. I only have one store which is the frustrating part. It looks like Magento considers the admin a store.

The only thing that has worked for me was importing the products with 'replace' option. And for SEO purposes I don't want to change the url's of my products, not even if it's just adding a number after.

I'm going to try deleting the url rewrites for products only.

I ran into a similar problem. In Magento 1, it was possible to truncate the url rewrite table and reindex. Magento 2 does not have a url rewrite indexer, so this is not an option.

Many suggest the Iazel extension. I went with the extension by Olgeg Koval, and it worked beautifully. Running Magento 2.2, it deleted all existing url rewrites and regenerated them for all store views. Zero problems.

All you need to do in order to regenerate rewrites is to initiate a rewrite. Go to a category or product and change its url in the SEO section of the product/category by adding a "a-" to the front of it. For example:

Url = "product-name" New Url = "a-product-name"

This will trigger the rewrite and redo all other rewrites.

In order to regenerate the URL rewrites in Magento 2,

  • Sign-in to the backend.
  • Navigate to Stores -> Configuration -> General -> Web
  • Expand the Search Engine Optimization section
  • Set the Use Web Server Rewrites to ‘Yes’.
  • Click the Save Config button to save your settings.
라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 magento.stackexchange
scroll top