2

My Magento store is setup with my product category titled 'Technology'.
There are several subcategories that display static blocks only. The URL path to the subcategories should be /technology/subcat1/subcat2.

However, this URL is a 404. If I use /products/subcat1/subcat2 it works.
Essentially, when I use a subcategory in the 'Technology' category, I cannot use technology in the URL or links. The only path that will work is 'products'.
When debugging the url_path for my categories contains products even though the category in the admin is titled 'technology'.

I've tried clearing cache, indexes (even though url_rewrite indexes are handled differently in M2), adding URL rewrites in the admin, etc. Nothing seems to be working.

The 'Use Web Server Rewrites' config setting is set to 'Yes'.

  • you have to use www.domainname.com/technology/html. – Hitesh Vaghasiya Mar 14 at 3:40
  • This does not resolve the issue. As I look into this more, I believe the issue stems from the magento data migration tool bringing over old/bad url_rewrites. – mlunt Mar 14 at 14:27
0

Turns out that this was a result of using the data migration tool to migrate from M1 to M2

What I ended up doing was running the following MySQL commands to clear out all redirects for categories and products:

SELECT * FROM `eav_attribute` WHERE `attribute_code` = 'url_path'; (This gives the attribute_id’s for the url_path for the next queries)
DELETE FROM catalog_category_entity_varchar WHERE attribute_id=47;
DELETE FROM catalog_product_entity_varchar WHERE attribute_id=83;
TRUNCATE catalog_url_rewrite_product_category;
SET FOREIGN_KEY_CHECKS=0;
TRUNCATE url_rewrite;
SET FOREIGN_KEY_CHECKS=1;

At this point, all of the URLs for products and categories should be the SEO unfriendly versions. However, once a category is saved I see the correct entry in the catalog_category_entity_varchar database table. I used a tool(https://github.com/olegkoval/magento2-regenerate_url_rewrites) to regenerate all the product urls.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.