[英]How to edit canonical meta tag for category from http to https in magento 1.9.x
我尝试在类别->自定义设计->自定义布局更新中添加代码
<reference name=”head”>
<action method=”addLinkRel”>
<rel>canonical</rel>
<href>https://yourwebsiteadress.co.uk/page-name.html</href>
</action>
</reference>
但它不起作用.....
是否有其他方法可以将所有http转换为https,而无需手动向其中添加代码。 如果我要添加此语法目录->管理类别->自定义设计->显示xml数据的自定义布局更新无效,请帮我,我是magento的新手
如果您使用默认主题并且没有对其进行过多更改,则不需要手动添加代码,请转到“ admin - system - Configuration - GENERAL - Web - Use Secure URLs in Frontend
”,将其设置为“ 是 ”。
转到“ admin - system - Configuration - Catalog - Catalog - Search Engine Optimizations - Use Canonical Link Meta Tag For Categories
”,将其设置为“ 是 ”。
然后它将起作用。
下拉菜单中的“ admin - system - Configuration - Catalog - Catalog - Search Engine Optimizations - Use Canonical Link Meta Tag For Categories
”下拉菜单应设置为No ,以便您可以在类别页面上的“自定义布局更新”框中手动添加规范标签。
<reference name=”head”>
<action method=”addLinkRel”>
<rel>canonical</rel>
<href>https://example.com/page-name.html</href>
</action>
</reference>
您的“自定义布局”代码应为“ https ...”,将其写为“ http”,缺少“ s”。
您可以在<IfModule mod_rewrite.c>
标记下的magento根.htaccess文件中编写以下代码,以重定向https上的所有http URL。
## HTTP to HTTPS redirection
RewriteCond %{HTTPS} off
RewriteCond %{REQUEST_URI} !^/downloader.*$
RewriteRule ^(.*)$ https://%{HTTP_HOST}%{REQUEST_URI} [L,R=301]
RewriteCond %{REQUEST_URI} !^/downloader.*$
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.