简体   繁体   English

如何在magento 1.9.x中将类别的规范元标记从http编辑为https

[英]How to edit canonical meta tag for category from http to https in magento 1.9.x

I tried adding code in category ->custom Design->Custom Layout update 我尝试在类别->自定义设计->自定义布局更新中添加代码

<reference name=”head”>
    <action method=”addLinkRel”>
       <rel>canonical</rel>
          <href>https://yourwebsiteadress.co.uk/page-name.html</href>
    </action>
</reference>

but it is not working..... 但它不起作用.....

Is there any alternative way to convert all http to https without manually adding code into it. 是否有其他方法可以将所有http转换为https,而无需手动向其中添加代码。 If i am trying to adding this syntax catalog-> manage categories -> Custom Design ->custom layout update showing xml data is invalid please help me out i am new in magento 如果我要添加此语法目录->管理类别->自定义设计->显示xml数据的自定义布局更新无效,请帮我,我是magento的新手

Default way 默认方式

If you use the default theme and doesn't change it too much, it should not need manually adding codes, go to " admin - system - Configuration - GENERAL - Web - Use Secure URLs in Frontend ", set it as " Yes ". 如果您使用默认主题并且没有对其进行过多更改,则不需要手动添加代码,请转到“ admin - system - Configuration - GENERAL - Web - Use Secure URLs in Frontend ”,将其设置为“ ”。

Go to " admin - system - Configuration - Catalog - Catalog - Search Engine Optimizations - Use Canonical Link Meta Tag For Categories ", set it as " Yes ". 转到“ admin - system - Configuration - Catalog - Catalog - Search Engine Optimizations - Use Canonical Link Meta Tag For Categories ”,将其设置为“ ”。

Then it would work. 然后它将起作用。

Manually add canonical 手动添加规范

The " admin - system - Configuration - Catalog - Catalog - Search Engine Optimizations - Use Canonical Link Meta Tag For Categories " dropdown should be set to No , so that you can manually add canonical tags to Custom Layout Update box on your category page. 下拉菜单中的“ 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>

Your "Custom Layout" codes should be "https...", you write it as "http", lack "s". 您的“自定义布局”代码应为“ https ...”,将其写为“ http”,缺少“ s”。

You can write the below code in magento root .htaccess file under <IfModule mod_rewrite.c> tag which redirect all the http url on https 您可以在<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.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM