opencart管理员在将http更改为https后无法工作



我是opencart的新手。我想在opencart中启用SSL。所以我尝试更改以下文件。

config.php文件更改

// HTTP
define('HTTP_SERVER', 'http://example.com/');
// HTTPS
define('HTTPS_SERVER', 'https://example.com/');

admin/config.php文件更改

// HTTP
define('HTTP_SERVER', 'http://example.com/admin/');
define('HTTP_CATALOG', 'http://example.com/');
// HTTPS
define('HTTPS_SERVER', 'https://example.com/admin/');
define('HTTPS_CATALOG', 'https://example.com/');

system/library/url.php文件更改(第16行)

public function link($route, $args = '', $secure = true)

.htaccess将更改放在代码后面。

RewriteEngine On
RewriteCond %{HTTPS} off
RewriteRule (.*) https://%{HTTP_HOST}%{REQUEST_URI} [R,L]

管理面板更改`Setting>Server>Use SSL setyes'

在以上更改后,我无法登录管理面板不显示任何错误消息。

在root和admin文件夹中编辑config.php文件,指向https URL和.htaccess文件。

也在system/config目录中

分别为2个文件:

admin.php(用于管理后端)

查找

$_['site_ssl']         = false;

将其更改为

$_['site_ssl']         = true;

与catalog.php文件相同(用于前端)

您错过了管理url的https。更改admin/config.php 中的以下值

define('HTTPS_SERVER', 'http://example.com/admin/');
define('HTTPS_CATALOG', 'http://example.com/');

define('HTTPS_SERVER', 'https://example.com/admin/');
define('HTTPS_CATALOG', 'https://example.com/');

转到根文件夹,单击系统,然后转到配置,突出显示admin.php,然后编辑它…确保站点ssl是真正的

使整个网站成为SSL,这是现在的趋势(如在amazon.co.uk等网站上),并提供了一点SEO提升。我不得不将http_server设置为https。除此之外:

OpenCart 1.5 的https

在设置/系统/服务器中打开检查admin/config.pgp和config.php是否设置了正确的SSL url

在config.php中设置http_server设置-通常并且应该是http。当设置为https时,似乎会对其进行排序。

所以在config.php中,我现在有了

<?php
// HTTP
define('HTTP_SERVER', 'https://www.example.com/');

因此,现在当我在http中"查看源代码"并搜索http://的任何引用时,我没有得到任何返回。

很容易解决这个问题。在system/library/url.php 中

更改

if ($connection ==  'NONSSL') {
    $url = $this->url;  
} else {
    $url = $this->ssl;  
}

$url = $this->ssl;

这将强制所有链接使用https

在管理页面中创建新的.htaccess文件,其中只有以下代码:

RewriteBase /

最新更新