I have overridden the CategoryController, and can access the overridden controller using the direct URL: eg. http://myshop.dev/catalog/category This URL has the following alias associated with it: http://myshop.dev/men-s/clothing However, when accessing the alias, the original controller is used. How can I make Magento use the overridden controller here as well?

My config.xml rewrite rule is as follows:


1 Answer 1


Which Magento version are you using? As far as I know, this way of rewriting controllers was used in previous versions. With newest versions (>1.4), you could use the following:

                        <mynamespace_mymodule before="Mage_Catalog">Mynamespace_Mymodule</mynamespace_mymodule>

Now Magento will look in your controllers folder first - notice the before attribute - every time a request for catalog is received. Next, place a CategoryController.php in your controllers folder. The class should look like this:

class Mynamespace_Mymodule_CategoryController extends Mage_Catalog_CategoryController
    // Your code here

Don't forget to manually include the original controller, as controllers are not autoloaded by Magento.

For further reference, see also http://www.magentocommerce.com/wiki/5_-_modules_and_development/0_-_module_development_in_magento/how_to_overload_a_controller

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.