URL Rewrites Optimization

URL Rewrites Optimization

Compatible With: Community 1.4,, 1.4.2, 1.5, 1.6, 1.6.1,, 1.7, 1.8, 1.8.1, 1.9, 1.9.1, 1.9.2, 1.9.3

Tech Specifications

Current Version:
Stable Build
05 February, 2018
Extensions, Site Optimization, Performance
License Type:


Increases perfomance of your store by optimizing the "core_url_rewrite" Magento® database table. Vital fixes.

Other Extensions by SafeMage


Back to top

It’s a matter of common knowledge that, with time, the "core_url_rewrite" Magento® table continuously increases in size, which, in turn, affects website’s performance and reduces the processing efficiency of data bases. We’ve figured out a source of the problem and have developed a sublime solution for you. The extension examines the table and detects excessive records that can be safely removed. The fewer records to address, the more resources to distribute for necessary tasks. Just consider the module as a shredder for shop checks you always get and put into your pocket. You don't really need to keep them, but you get more and more of them in your daily life. You either get bigger pockets or just keep important checks only.

The reason for increasing size of the foregoing table is duplicating/intersecting URL keys of products and categories. It is known that Magento’s code renames identical URL’s to [url_key]-1, [url_key]-2, and so on.

However, next time one saves a product or runs "Catalog URL Rewrites" reindex, for no explicit reason, previously generated URL’s change again:

[url_key]-1 -> [url_key]-3 -> [url_key]-5

[url_key]-2 -> [url_key]-4 -> [url_key]-6

In addition, for the previous URL to work, Magento’s code adds several redirect records:

[url_key]-1 -> [url_key]-5

[url_key]-3 -> [url_key]-5

[url_key]-2 -> [url_key]-6

[url_key]-4 -> [url_key]-6

Even more, if a product is contained by several categories, a number of the records is multiplied by a number of the categories. This is pure geometric series!

This happens infinite number of times with every reindex or product/category edit. The table grows bigger and bigger, reindexing slows down, and a number of records increases by almost half.

How It Works

1) First, admin should empty excess redirects

• System > Configuration > SafeMage > URL Rewrites Optimization > Clearing Settings of ''core_url_rewrite'' Table

The options here are as follows: "Remove All Excess Redirects" or "Qty of Latest Redirects to Keep". The latter enables admin to keep a certain number of latest redirects. It is important in cases when a product/category is represented by an old URL in Google search index, for example [product_url_key]-197123. Thus, a customer navigating to this URL, after being redirected, would see the initial product page, not a 404 error page. In about a month, admin may initiate a total clean-up.

2) After safe clearing has been done, it is recommended to run reindex

• System > Index Management > Catalog URL Rewrites > Reindex Data

URL's of "Disabled" or "Not Visible Individually" products or inactive categories will not be added to ''core_url_rewrite''. This will enable decreasing the table size even more significantly, especially if the store includes many Configurable or Bundle products.

3) Later on, the extension automatically fixes several Magento® bugs appearing during Catalog URL Rewrites reindex or while saving product/category. So the table won’t be increasing in size without real necessity.

4) Optionally admin can enable "Unique URL Key Verification" => Yes.

As a matter of fact, having optimized one of the Magento®-based webstore, we’ve decreased a number of table records from 27 million to just 45 thousand (600 times lighter table). The size of that table has remained on the similar level to this day.


• Optimization after effect guarantees minimal size of the table "core_url_rewrite" (in some cases 10000 times less records)

• Fixes several bugs of Magento® itself appearing during Catalog URL Rewrites reindex or when saving product / category

• Fixes an issue with reindex when the following setting is set to No:

System > Configuration > CATALOG > Catalog > Search Engine Optimizations > Use Categories Path for Product URLs

• "core_url_rewrite" table's size remains on the same level

• URL's of "Disabled" or "Not Visible Individually" products or inactive categories are not added to "core_url_rewrite"

• Safe clearing of the table enables removal of excess redirects (with/without set qty of latest redirects to keep or keeping visited URLs from "log_url_info" table)

• Unique URL key verification during products / categories edits.

• Restore URLs ending with a digit

• Clearing by cron schedule

• Log tables checking and clearing


Please share your results of the "core_url_rewrite" table optimizations done by our product, e.g. records: before > now.

Release Notes

Back to top


  • Compatible with CE: 1.4.2 1.5 1.6 1.6.1 1.7 1.8 1.8.1 1.9 1.9.1 1.9.2 1.9.3
  • Stability: Stable Build
  • Description:

    Addressed a cron-related issue.


  • Compatible with CE: 1.4.2 1.5 1.6 1.6.1 1.7 1.8 1.8.1 1.9 1.9.1 1.9.2 1.9.3
  • Stability: Stable Build
  • Description:

    Added a new 'Routing of Pages Ending with a Digit' setting;
    Added compatibility with Mageworx SEO Suite;
    Improved optimization results when the ‘Use Categories Path for Product URLs’ setting is set to ‘No’.


  • Compatible with CE: 1.4 1.4.2 1.5 1.6 1.6.1 1.7 1.8 1.8.1 1.9 1.9.1 1.9.2 1.9.3
  • Stability: Stable Build
  • Description:

    Addressed an issue with rewrites for disabled categories.


  • Compatible with CE: 1.4 1.4.2 1.5 1.6 1.6.1 1.7 1.8 1.8.1 1.9 1.9.1 1.9.2
  • Stability: Stable Build
  • Description:

    Added Global URL feature (experimental).


Back to top
The best place to start if you need help with a specific extension is to contact the developer. All Magento developers have both a contact email and a support email listed.

Q & A

Back to top


Back to top