【问题标题】:Magento Static block URLMagento 静态块 URL
【发布时间】:2012-10-04 03:26:15
【问题描述】:

我在 Magento 静态块中添加了一些链接,例如:

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

这似乎工作得很好,但是一旦我使用 HTTPS,链接仍然是 http:// 格式。有没有办法让这些也自动更改为 HTTPS?

一些建议将不胜感激。

【问题讨论】:

标签: magento


【解决方案1】:

默认情况下这是 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 rewrite 会将页面重定向到 https,但查看源时的链接仍然没有 https

如果您在服务器上启用了缓存,请仔细检查以确保它不缓存一个版本....如果缓存,那么您需要将块类型(核心/模板)更改为不缓存的)

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2011-05-20
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多