Sunday , June 26 2016
Home >> All tutorial >> Magento tutorials : URL Rewrite (Part 3)

Magento tutorials : URL Rewrite (Part 3)

Magento Tutorials : URL Rewrite

URL rewrite is something that is not easy to understand. As a developer, you may clearly know the structure, process and others of URL Rewrite. I have made several Magento Tutorials to get this job done, and today; I will share you materials of URL rewrite to fully exploit it in Magento for the best Search Engine exposure.

I. URL structure/processing in Magento.
– URL structure in Magento
A link in Magento has format as below:


  • user:password@host:443/base_path/[base_script]: the path to the Script file which runs Magento. Usually, it is an index.php file.
  • [storeview_path]: store view code will display here. According to the configuration, this storeview_path is inserted into the link or not.
  • route_name/controller_name/action_name: the path to the action which is run by the request of this link.
  • param1/value1: name and value of the parameter for the request that is provided by the link.
  • t?query_param=query_value#fragmen: query

– URL processing in Magento
With the link as same as above, when you request it will run into the index.php file firstly, and then the following files:

  • app/Mage.php (Mage::app()->run())
  • app/code/core/Mage/Core/Model/App.php
  • Init and Dispatch controller ($this->getFrontController()->dispatch());
  • app/code/core/Mage/Core/Controller/Varien/Front.php
  • Chose the router match for dispatch ($router->match($this->getRequest()))

• app/code/core/Mage/Core/Controller/Varien/Router/Admin.php
• app/code/core/Mage/Core/Controller/Varien/Router/Standard.php
• …
• app/code/core/Mage/Core/Controller/Varien/Router/Default.php

  • app/code/core/Mage/Core/Controller/Varien/Action.php

• Call Action function (Example: indexAction())

  • Custom Controller/Action
  • (app/code/core/Mage/Core/Controller/Response/Http.php)

The link process is primarily conducted in routers (the detail is the function match($request). This function will analyze URL to find out the action to call. When discovering the action, the system will leave the control authority to this action. After carrying out, the action will return the control authority to the system. And then the system returns the response content of that link.

II- URL rewrite process.
– The URL rewrite process takes place in 3 moments:

  • Core URL rewrite: from the request path, the system will find target_path in CSDL and rewrite the request path.

Magento tutorials

  • Module configure URL rewrite: is the controller rewrite in the system. From the configuration, the system will rewrite the link.

Tutorial Magento

  • Router URL rewrite: Use the router to analyze and rewrite the link. A typical example: the system uses this router to rewrite the link for CMS page (use events to add routers).

III. Rewrite a catalog/ product/ view to a different URL.
– Rewriting catalog/product/view to another URL is used in the Core URL Rewrite process. The link of rewriting catalog/product/view will be stored in the core_url_rewrite table.

If you have any questions, don’t hesitate to contact with us or leave a comment below. Magento Tutorials series will continue to be posted in the next days.

--- Latest News ---

Wanna save your time for importing & exporting data between multiple systems?

Check this extension: magento salesforce integration. It will automate all your tedious tasks by connecting & transferring data between Magento & Salesforce. Managing all data in 1 place is a piece of cake now.

magento salesforce

Plus, the new Magestore pos ipad is released, demo it now.


About Champ


  1. Would love to know how url rewriting on IIS can be applied for SEO optimization, also see my post here:

  2. Hey there! Your websites are running slow , that went on just like a minute to finally load up, I
    actually have no idea if it is just me or maybe web page however
    facebook performed acceptable for me. Anyways, I’m going to thank you very much for adding beautiful article.

    Everybody who actually visited this site really should have noticed this short article
    extremely useful. I personally have to point out that you actually have done brilliant
    job with this and also wish to find out further brilliant things from you.

    I already have your site saved to bookmarks to check out new stuff you post.

Leave a Reply

Your email address will not be published. Required fields are marked *

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <s> <strike> <strong>