'ajax/product/sendfriendemail'
is not a core URL,
Most probably you have a module that contains this in the config.xml
<frontend>
<routers>
<ajax>
<use>standard</use>
<args>
<module>[Namespace]_[Module]</module>
<frontName>ajax</frontName>
</args>
</ajax>
</routers>
</frontend>
Notice the <frontName>ajax</frontName>
. That's the first part of the URL ajax/product/sendfriendemail
.
Magento looks in the merged config for a node with frontName
identical to the first part of the url and when it finds it it maps the rest of the url relative to that module.
So in the example above ajax
corresponds to the module [Namespace]_[Module]
so magento will try to match the rest of the url product/sendfriendemail
to the controller ProductController
from the module [Namespace]_[Module]
and execute the method sendfriendemailAction
.
This is just the main part.
There are exceptions. you can tell magento for the same key (ajax
in this case) to look in multiple modules in a specific order and call the first valid method it finds in a valid controller.
For this, you have to define the routes for your module like this:
<routers>
<standard>
<args>
<modules>
<[Namespace]_[Module] before="[Other]_[Module]">[Namespace]_[Module]</[Namespace]_[Module]>
</modules>
</args>
</standard>
</routers>
This means that the module [Namespace]_[Module]
will use the same frontName
as the module [Other]_[Module]
. If the rest of the url cannot be mapped to a controller and an action from [Namespace]_[Module]
it will try to map it to a controller and action from the initial module [Other]_[Module]