7

In my Magento website I have configured SSL certificate in some pages only. So how to check if the current page has http:// or https://?

I am using Magento 1.9

2 Answers 2

8

You can use below as another solution:

if (Mage::app()->getStore()->isFrontUrlSecure() 
    && Mage::app()->getRequest()->isSecure()
) {
    // current page is https
}else {
    // current page is http
}
1
  • i have added SSL in my site & i want to redirect selected page on http url instead of https. so how can i do that ? Apr 27, 2018 at 5:19
10

You can use

$isSecure = Mage::app()->getStore()->isCurrentlySecure(); 

or

$isSecure = Mage::app()->getFrontController()->getRequest()->isSecure(); 

Source here.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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