views:

875

answers:

2

Hi all,

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

+2  A: 

In app/code/core/Mage/Customer/etc/config.xml there's an entry for frontend/secure_url for /customer.

Greg
What's the best practice to set this as default, in other words; if secured urls is configured to 'YES' i just want all my internal links to start with https://
Roland Franssen
probably best to extend or over-ride the helper that does the URL building, and runs the check against config for whether it should be secure or not. Off the top of my head, it will be in app/code/core/Mage/Core/Helper/Url.php (maybe Model/Url.php?) and you'd want to copy it to the same place under code/local or, if you have a module of your own already, you could put a rewrite into the config.xml and just over-ride the bit you need.
Greg
A: 

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))

Magento Development Company