0

I am trying to work out why some of my URLs are being presented like the below

/catalog/product/view/id/75/s/whiskware-egg-mixer/category/15/

I have run bin/magento indexer:reindex but the URLs aren't matching the keys which have been set via the adminpanel

The URL key in admin panel is whiskware-egg-mixer and when I browse to this path I am presented with a 404 error

  • Truncate url_rewrite table and run indexing again bin/magento indexer:reindex – Shoaib Munir Mar 12 at 5:54
0

Depending on your configuration the URL for your product is not the same with the url key. Check the settings in Stores > Configuration > Catalog > Search Engine Optimization.

By default product URLs have an suffix .html. So most likely your URL is whiskware-egg-mixer.html. If your are using category paths in URLs there should also be additional entries in the url_rewrite table for your product.

For getting the exact URLs of your product in your system I would suggest to check the url_rewrite table like this:

select * from url_rewrite where entity_id = [your product id] and entity_type = 'product';
-- for your example use
select * from url_rewrite where entity_id = 75 and entity_type = 'product';

This should give you a hint if something is going wrong.

  • we arent using a suffix, nor category paths in the URL structure – Paul 'Whippet' McGuane Mar 12 at 6:31
  • And what is the output of the SQL? – HelgeB Mar 12 at 6:39
  • no rows can be found – Paul 'Whippet' McGuane Mar 12 at 6:45
  • That looks like something is going wrong. I would suggest the following test: Change the url key to something else, save the product and see if you get entries in the url_rewrite table. If yes change the url key back to your original value and see what happens. Since Magento 2 does not rebuild url rewrite table like Magento 1 you may use an extension if you want to rebuild all urls, like github.com/olegkoval/magento2-regenerate_url_rewrites. – HelgeB Mar 12 at 6:56
  • done this test already no luck though – Paul 'Whippet' McGuane Mar 12 at 7:00

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.