سؤال

لقد تم تكوين الماجنتو لاستخدام SSL الروابط..

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

الواجهة لدي بعض وصلات مخصصة بنيت مع ماجى::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/
?>

لماذا هناك اختلاف في البروتوكول ؟

// رولاند

هل كانت مفيدة؟

المحلول

في app/code/core/Mage/Customer/etc/config.xml هناك إدخال frontend/secure_url ل/customer.

وهذا سوف يساعد

نصائح أخرى

وكان لي مشكلة مع HTTPS في وحدة مخصصة بلدي، حول وعملي مثل هذا:

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

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

أعتقد أن هذا هو أفضل (من: 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()));

هذا عمل لي

echo Mage::getUrl('customer/account/loginPost',array('_secure'=>true));

على سبيل المثال:

إذا كنت تصفح مع http ثم

echo Mage::getUrl('customer/account/loginPost',array('_secure'=>true));
// http://dominio.com/customer/account/loginPost

إذا كنت تصفح مع https ثم

echo Mage::getUrl('customer/account/loginPost',array('_secure'=>true));
// https://dominio.com/customer/account/loginPost
مرخصة بموجب: CC-BY-SA مع الإسناد
لا تنتمي إلى StackOverflow
scroll top