When product URLs behave unexpectedly, a direct look at Magento’s url_rewritetable can be useful. It stores public-facing paths, internal targets and redirects for product URLs.

Use the following query to display URL rewrites for a specific SKU:

request_path contains the URL visible to customers, while target_path points to Magento’s internal target. The field store_id bzw. store_name identifies which store view each rewrite belongs to.

Several entries for one product are not necessarily duplicates or errors. Different store_id values usually mean Magento maintains separate rewrites for different store views.

Also useful is redirect_type. The value 0 means a normal rewrite without a redirect, 301 and 302 indicate permanent and temporary redirects respectively.

After changing URL keys, migrating or importing data, this query helps you see which rewrites Magento actually stores for a product.

Finding Product URL Rewrites with SQL
Need help implementing this solution, or still looking for the right solution to your Magento problem? Get in touch and I will be happy to help with your Magento project!
Tags: