[英]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.