Magento - problem after SSL certificate - admin controller issue


Synopsis:
After installing SSL certificate the front controller of a module starts using https, but it is not designed to use secure URLs.

Cause of the problem:
The module is using two controllers, one for front end and the other is for admin.
Name of the front controller and admin controller are same.

When SSL is installed admin panel is secured with https protocol.
Admin controller has higher precedence than front controller.
So whenever a request is made in front end, admin controller of the module is dispatched first and as SSL is installed it will be redirected with https protocol.

How to resolve:
For a quick fix, change admin controller's frontname.
If your admin controller config was
    <admin>
        <routers>
            <example>
                <use>admin</use>
                <args>
                    <module>Namespace_Example</module>
                    <frontName>example</frontName>
                </args>
            </example>
        </routers>
    </admin>
Change it to
    <admin>
        <routers>
            <exampleadmin>
                <use>admin</use>
                <args>
                    <module>Namespace_Example</module>
                    <frontName>exampleadmin</frontName>
                </args>
            </exampleadmin>
        </routers>
    </admin>

Do not forget to change action url of menus in admin.
Your action URL for admin menu may before
<action>example/adminhtml_example</action>
change it to
<action>exampleadmin/adminhtml_example</action>

Finally do not forget to update layout handles.
may before
<example_adminhtml_CONTROLLER_index>
change to
<exampleadmin_adminhtml_CONTROLLER_index>

How to avoid this glitch in future?
As prevention is better than cure, one should not use admin controller, instead use adminhtml controller.

No comments:

Post a Comment