Magento SSL Links
I have 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 created 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
Roland Franssen
source
to share
4 answers
There app/code/core/Mage/Customer/etc/config.xml
is an entry for frontend/secure_url
for /customer
.
This will help
+4
Greg
source
to share
I have a problem with https in my custom module; my work was like this:
$loadFromSSL = $_SERVER['SERVER_PORT']==443?true:false;
Mage::getUrl('', array('_secure'=>$loadFromSSL))
+5
Magento Development Company
source
to share
I think this is better (from: http://thecompleteprogramer.wordpress.com/2012/09/11/magento-get-url-with-or-without-secure-path-according-to-current-url-protocol / )
Mage::getUrl('yourpath', array('_secure' => Mage::app()->getFrontController()->getRequest()->isSecure()));
+4
Krzysztof CheΕchowski
source
to share
it worked with me
echo Mage::getUrl('customer/account/loginPost',array('_secure'=>true));
For example:
if you are browsing http then
echo Mage::getUrl('customer/account/loginPost',array('_secure'=>true));
// http://dominio.com/customer/account/loginPost
if you are browsing https then
echo Mage::getUrl('customer/account/loginPost',array('_secure'=>true));
// https://dominio.com/customer/account/loginPost
0
juan.conde
source
to share