2012-10-04 84 views
0

我已经添加在Magento的静态块一些链接,例如:Magento的静态块URL

<a title="Click here for more information" href="{{store_url=about-us}" target="_self">About Us</a> 

这似乎是工作得很好,但是一旦我在HTTPS链接保持在一个http://格式。有没有办法让这些自动更改为HTTPS呢?

一些意见,将大大appreaciated。

+0

在类似的问题: http://stackoverflow.com/questions/584251/short-way-to-link-to- HTTP的从-HTTPS的和使用-反之亦然-相对链接 – PiLHA

回答

0

默认情况下这是怎么Magento的行为方式。

尝试创建一个links.phtml文件用下面的代码

if(Mage::app()->getStore()->isCurrentlySecure()){ 
    $url = Mage::getUrl('about-us', array('_secure'=>true)); 
    //$url = Mage::getUrl('',array('_secure'=>true) . 'about-us'; // if above code doesn't work try this 
} 
else{ 
    $url = Mage::getUrl('about-us'); 
} 

echo '<a title="Click here for more information" href="'. $url .'" target="_self">About Us</a>'; 

然后在静态块

{{block type="core/template" template="path/to/file/links.phtml"}} 

使用Apache重写将重定向页面,HTTPS,但观看时的根据链接源将仍然是没有HTTPS

如果您缓存上启用服务器双重检查,以确保它不缓存一个版本....如果缓存,那么你就需要更改块类型(核心/模板),以一个不缓存)