Magento SSL links

Roland Franssen picture Roland Franssen · Sep 11, 2009 · Viewed 9.4k times · Source

I've configured magento to use SSL links..

Base URL      https://sub.domain.com/
Base Link URL {{secure_base_url}}
Base ... URL  {{secure_base_url}}.../

Use Secure URLs in Frontend: YES
Use Secure URLs in Backend:  YES

Frontend i have some custom links built with Mage::getUrl([...])

<?php
// link to CMS page
echo Mage::getUrl('help'); //-> http://sub.domain.com/help/
// link to customer account
echo Mage::getUrl('customer/account'); //-> httpS://sub.domain.com/customer/account/
?>

Why is there a difference in protocol?

// Roland

Answer

Magento Development Company picture Magento Development Company · Sep 29, 2010

I had an issue with https in my custom module; my work around was like this:

$loadFromSSL = $_SERVER['SERVER_PORT']==443?true:false;

Mage::getUrl('', array('_secure'=>$loadFromSSL))