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>
Thanks for this post. I was having this exact issue with my website redirecting to https when not desired and breaking certain elements of the website.
This post fixed it. Thank you very much.
Excellent Post. I have been researching a fix since days. This really saved my day!!
Thanks a lot
Thank you for pointing out :) my problem is solved.. i have changed just admin router name. Now my custom module working fine without forcing frontend to secure url.