If secure url is enable, sometimes Magento custom module frontend url is forced to https but that’s not what I am intended to. I look into it and find it happens when it uses an identical router frontName both for <frontend> and <admin>.
The module etc/config.xml is like this:
<?xml version="1.0" encoding="UTF-8"?> <config> <modules> <Mynamespace_Mymodule> <version>0.1.0</version> </Mynamespace_Mymodule> </modules> <frontend> <routers> <mymodule> <use>standard</use> <args> <module>Mynamespace_Mymodule</module> <frontName>mymodule</frontName> </args> </mymodule> </routers> </frontend> <admin> <routers> <mymodule> <use>admin</use> <args> <module>Mynamespace_Mymodule</module> <frontName>mymodule</frontName> </args> </mymodule> </routers> </admin> </config>
If frontend router is changed to something different from admin router (change both frontName and routers xml tag name), then the frontend is not redirected to https. If only frontName is different but routers xml is identical, then {{store url=”router_xml_tag/controller/action”}} results an admin frontName; if only routers xml is different but frontName is identical, then frontName is still forced to https.
What if a module does require a secured connection for <frontend> without <admin>? Just add <secure_url> tag inside <frontend> tag. A sample like this:
<?xml version="1.0" encoding="UTF-8"?> <config> <modules> <Mynamespace_Mymodule> <version>0.1.0</version> </Mynamespace_Mymodule> </modules> <frontend> <secure_url> <mymodule>/mymodule/</mymodule> </secure_url> <routers> <mymodule> <use>standard</use> <args> <module>Mynamespace_Mymodule</module> <frontName>mymodule</frontName> </args> </mymodule> </routers> </frontend>
Leave a Reply