-
Notifications
You must be signed in to change notification settings - Fork 9.4k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
how to rebuilding URL rewrite? #3679
Comments
I tried to "truncate" the table and got a Cannot truncate a table referenced in a foreign key constraint ( What was wrong with the URL's in the database? |
I use phpmyadmin truncate tables. |
What is purpose of truncating tables? It is not expected to do, and do not expect to support such actions. |
I truncated the url_rewrite table because I met the error - 'URL key for specified store already exists.' I followed the suggestions in the discussion list and it did work. However, the rewritten url never came back even I manually input the url and saved the categories again. |
@dexteritycc yes but truncating is not the solution. I also think that your FOREIGN KEY are not ON? |
@daim2k5 Do you mean the FOREIGN KEY constraints? |
@dexteritycc yes |
You should not modify the database. I will close this one and discussion can continue in #1471 |
@daim2k5 I have found a solution that sort of works if you have not dealt with this yet (year late, but idk /shrug). If so, this is here for anyone else coming across this issue as well. Steps for Solution
SET FOREIGN_KEY_CHECKS = 0;
TRUNCATE TABLE url_rewrite;
SET FOREIGN_KEY_CHECKS = 1;
Now your URL rewrite table will be filled with only your used rewrites. I don't recommend doing this if your store has been live for quite some time (people may have bookmarks, and your site may be indexed by search engines already - potentially harming your SEO rankings). @piotrkwiecinski That's not a very helpful answer and issue #1417 is not the same as what is happening here. What we are looking to have done is reindex all URL rewrites (cms, product, and category) to remove unused/old records. It's an inefficient aspect of Magento 2 to allow the What you have linked to, is users having issues with importing via |
We need to truncate both the tables url_rewrite and catalog_url_rewrite_product_category table after we need to follow the steps otherwise we can reindex using the following commands sudo php bin/magento indexer:reindex |
[TSG-CSL3] For 2.2 (pr20)
You can rebuild URL rewrites from admin area using this extension. It also allows you to customize the URLs and generate unique URLs by adding for ex the SKU in the URL https://marketplace.magento.com/webpanda-catalog-url-rewrites.html |
Steps to reproduce
Expected result
Actual result
The text was updated successfully, but these errors were encountered: