11

I've created a Module with some pages and I'm wondering how do I force this pages to use SSL on the url, like the customer login page. Not all of the pages need it, but some do.

What comes to mind (though I haven't tried it) is to evaluate the url in the action controller and redirect to https:// if SSL is enabled in magento config and the current URL is not using it.

Is this approach correct? Or does this kind of setting go in the configuration file?

13

Yes it goes into the configuration file. If you look at core/Mage/Checkout/etc/config.xml you can see how Magento does it for the checkout:

<frontend>
    <secure_url>
        <checkout_onepage>/checkout/onepage</checkout_onepage>
        <checkout_multishipping>/checkout/multishipping</checkout_multishipping>
    </secure_url>
</frontend>

You can configure your own controllers to use the secure URL in the same way.

The name of the tag (<checkout_onepage>) can be anything, as long as it is unique.

The value (/checkout/onepage) must match the beginning of the URLs that should be secure. It's compared with the actual URL, not the route name!

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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