简体   繁体   English

SSL配置Opencart 3.x

[英]SSL config Opencart 3.x

I have SSL working on my site artindia.eu . 我在我的站点artindia.eu上使用SSL。

When browsing https://www.artindia.eu/laptop-notebook/macs for example, the padlock changes from green to grey in Chrome browser. 例如,当浏览https://www.artindia.eu/laptop-notebook/macs时 ,Chrome浏览器中的挂锁从绿色变为灰色。

I think there is something I need to add or change in catalog/controller/product/category.php, but what I don't know. 我认为我需要在catalog / controller / product / category.php中添加或更改某些内容,但是我不知道什么。

Does anyone know? 有人知道吗?

Its very simple issue usually happen with https and http websites. 它非常简单的问题通常发生在https和http网站上。

For example: is using https 例如:正在使用https

https://www.artindia.eu/laptop-notebook/macs

If you use 如果您使用

// instead of http with all resources on page then padlock will show green icon. //而不是http,而不是页面上的所有资源,然后挂锁将显示绿色图标。 as it says unsecured content on the pagee issue. 因为它说有关分页问题的不安全内容。

to elaborate here we have a example 在这里详细说明我们有一个例子

Correct ( href="//fonts.googleapis.com/css?family=Roboto:300,400,500,700,900" ) 正确(href =“ // fonts.googleapis.com/css?family=Roboto:300,400,500,700,900”)

<link href="//fonts.googleapis.com/css?family=Roboto:300,400,500,700,900" rel="stylesheet" type="text/css" />

Incorrect ( no need to use http:// when we have https enabled on site.) 不正确(当我们在站点上启用https时,无需使用http://。)

<link href="http://fonts.googleapis.com/css?family=Roboto:300,400,500,700,900" rel="stylesheet" type="text/css" />

Solution : Please remove all http from all assets that are loading on website. 解决方案:请从网站上加载的所有资产中删除所有http。

I checked the source of your site. 我检查了您网站的来源。 You just have made a typo: 您刚输入错字:

Change httpss://www.artindia.eu/image/catalog/AjaxLoader.gif 更改httpss://www.artindia.eu/image/catalog/AjaxLoader.gif

to https://www.artindia.eu/image/catalog/AjaxLoader.gif https://www.artindia.eu/image/catalog/AjaxLoader.gif

and your site will be fully trusted again. 您的网站将再次受到完全信任。

General issue: all assets loaded including images must be from HTTPS as well. 一般问题:加载的所有资产(包括图像)也必须来自HTTPS。

How to debug by yourself: Use the developer console of your preferred browser to check logs and warnings. 如何自行调试:使用首选浏览器的开发者控制台检查日志和警告。

Blockquote 大段引用

'href' => $this->url->link('product/product', 'path=' . $this->request->get['path'] . '&product_id=' . $result['product_id'] . $url, 'SSL') 'href'=> $ this-> url-> link('product / product','path ='。$ this-> request-> get ['path']。'&product_id ='。$ result ['product_id' ]。$ url,'SSL')

Blockquote 大段引用

I added SSL at the end of this line in ocfilter.php and I added :// after http & https in category.php. 我在ocfilter.php的此行末添加了SSL,并在category.php的http和https之后添加了://。 Then I disabled the Ajax Navigation modification in de admin panel. 然后,在管理面板中禁用了Ajax Navigation修改。

The Ajax Navigation mod changed the links of category/product. Ajax导航模块更改了类别/产品的链接。 Now this is done directly in the controller files. 现在,这直接在控制器文件中完成。

visit https version of the URL in your browser. 在浏览器中访问URL的https版本。 For example: http://mywebsite.com/image/catalog/AjaxLoader.gif change to https://mywebsite.com/image/catalog/AjaxLoader.gif IF and only if you get a result of an image. 例如: http : //mywebsite.com/image/catalog/AjaxLoader.gif更改为https://mywebsite.com/image/catalog/AjaxLoader.gif IF,并且仅当获得图像结果时。 Do the following 1. find a file called header.twig or header.tpl (depend on your opencart version) and open to edit it, Note: If you are are not using opencart default theme then go to the directory of your new theme and search for those files. 请执行以下步骤1.找到一个名为header.twig或header.tpl的文件(取决于您的opencart版本)并打开以进行编辑,请注意:如果您不使用opencart默认主题,请转到新主题的目录,然后搜索那些文件。 2. Insert following code within head section of file. 2.在文件的头部插入以下代码。

 <meta http-equiv="Content-Security-Policy" content="upgrade-insecure-requests"> 

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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