Magento Stack Exchange is a question and answer site for users of the Magento e-Commerce platform. It's 100% free, no registration required.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I'm developing a custom module. The module has to respond to requests on

How can I configure a router for this path in etc/config.xml?

This is different from the usual router configuration XML, because there is no frontname and no controller in the path.

share|improve this question
Why not use this?… – B00MER Apr 9 '14 at 21:40
up vote 3 down vote accepted

You're better off using a custom Router controller for that. Inchoo and Atwix have both tutorials describing how to do this.

The one from Atwix explains the easiest. Your Router.php would look something like this

class [Namespace]_[Module]_Controller_Router extends Mage_Core_Controller_Varien_Router_Standard
    public function match(Zend_Controller_Request_Http $request)
        if ($request->getPathInfo() == 'file.txt')

           return true;
            return parent::match($request);

share|improve this answer
One side-note, this only works if file.txt doesn't exist, or is explicitly rewritten to Magento's index.php. So if it doesn't seem to work, check for it's existence. – Melvyn Apr 9 '14 at 20:53
@Melvyn Depends on the server configuration. I redirect all requests to index.php, disregarding any file existence. – i.amniels Apr 11 '14 at 10:53
@i.amniels I assume you make exceptions for /skin, /js and /media at least. :) – Melvyn Apr 11 '14 at 18:43
@Melvyn No, those are handled by the CDN. – i.amniels Apr 13 '14 at 14:43

You can think about a url_rewrite for this. Just add a rewrite, then magento will resolve the correct controller for you!

share|improve this answer
Or Fabians route – B00MER Apr 9 '14 at 21:45

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

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