We recently migrated from a proprietary shopping cart to Magento Enterprise.

Currently we are using a custom module to redirect the old product URL's to the new Magento product URL's.

However, I am looking to move on from this front-end controller that handles this logic, to importing them as URL rewrite rules.

There seems to be a lot of documentation for creating a URL rewrite url in community edition, which uses the deprecated core_url_rewrite table.

Previously, you would do something like:

$results = Mage::getModel('core/url_rewrite')
    ->setDescription('legacy product id '.$legacy_id)

However, in Enterprise 1.13, the model I think I should be using is: enterprise_urlrewrite/url_rewrite

Can someone advise on how to do the equivalent? I can't seem to get it to show up in the admin, even after doing a reindex.


3 Answers 3


Firsly the model is now Enterprise_UrlRewrite_Model_Url_Rewrite:


Secondly the options have changed slightly to.



Note: category and product id are optional only for category and product rewrites

So assuming that your code is not for product or category rewrites:

$results = Mage::getModel('enterprise_urlrewrite/url_rewrite')
    ->setDescription('legacy product id '.$legacy_id)

I ran into a similar issue, creating custom rewrites (redirects) in Magento 1.13. I only saw them in the admin when I addressed the redirect model rather than url_rewrite.

Here is a snippet of what I was using to set redirects on save of my custom entity.

//check for existing redirect
$redirect = Mage::getModel('enterprise_urlrewrite/redirect')
    ->addFieldToFilter('target_path', $target_path)

    Mage::Log('no such redirect');
    $redirect = Mage::getModel('enterprise_urlrewrite/redirect');


The correct class to use is Enterprise_UrlRewrite_Model_Redirect, so mtopping was right. However I wouldn't use target_path to check if a rewrite exists as the field itself is not unique, request_path is (hence the column name is 'identifier). Here is what I would do:

Mage::getModel('enterprise_urlrewrite/redirect')->load($aRedirect['request_path'], 'identifier')
                ->setDescription('Redirect from old site')

That is, assuming you havea single store. For multistores you will have to use collection load. similar to what mtopping suggested but with extra addFieldToFilter for store id.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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