I'm not on a product page (custom module) and I have the URL of a product page. Is it possible to get the product ID from a URL?

I checked Mage::getUrl but that seem to generate URLs - I need it the other way round. Is there a possibility to do that? Via the rewrite table?


1 Answer 1


you can get the product ID as the following example, since you already have the path included the URL.

$oRewrite = Mage::getModel('core/url_rewrite')

$iProductId = $oRewrite->getProductId();


  • Awesome! Thank you, that worked fine for me.
    – Chris
    Nov 12, 2014 at 3:49
  • Glad it helped.
    – Rabea
    Nov 12, 2014 at 3:56

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