Opencart 2.2.x ssl用于所有请求


Opencart 2.2.x ssl for all request

我安装了opencart最新版本,我想为url 启用所有ssl

在管理设置SSL启用

在config.php中,admin和category都更改为https

htaccess

RewriteEngine On
RewriteBase /
RewriteRule ^sitemap.xml$ index.php?route=feed/google_sitemap [L]
RewriteRule ^googlebase.xml$ index.php?route=feed/google_base [L]
RewriteRule ^system/download/(.*) index.php?route=error/not_found [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_URI} !.*'.(ico|gif|jpg|jpeg|png|js|css)
RewriteRule ^([^?]*) index.php?_route_=$1 [L,QSA]
RewriteCond %{HTTPS} off
RewriteRule .* https://%{HTTP_HOST}%{REQUEST_URI} [L,R=301]
RewriteCond %{HTTP_HOST} !^www'.
RewriteRule .* https://www.%{HTTP_HOST}%{REQUEST_URI} [L,R=301]

但是当url不是SEO时,它可以工作,所以url与SEO不工作url将是https://www.localhost/index.php?route=台式机/mac

如何更改为https://www.localhost/desktops/mac

我还安装了opencart 2.2。

我尝试了https的扩展,但它破坏了一切;(

我找到了一个有效的解决方案3步:

••1••in.htaccess:在末尾添加

RewriteEngine On 
RewriteCond %{SERVER_PORT} 80 
RewriteCond %{REQUEST_URI} store 
RewriteRule ^(.*)$ https://www.__your_domain__.com/store/$1 [R,L]

••2••
在config.php中的root+admin

<?php
// HTTP
define('HTTP_SERVER', 'https://www.__your_domain__.com/store/');
// HTTPS
define('HTTPS_SERVER', 'https://www.__your_domain__.com/store/');

****即使在浏览器中使用https://也不够。。。。在源代码中,每个链接的http://。。。。****所以我找到了最后一步


••3••在系统/库/url中修改为https和voilà:)

public function link($route, $args = '', $secure = false) {
        if ($this->ssl && $secure) {
            $url = 'https://' . $_SERVER['HTTP_HOST'] . rtrim(dirname($_SERVER['SCRIPT_NAME']), '/.''') . '/index.php?route=' . $route;
        } else {
            $url = 'https://' . $_SERVER['HTTP_HOST'] . rtrim(dirname($_SERVER['SCRIPT_NAME']), '/.''') . '/index.php?route=' . $route;
        }

我刚刚花了一整晚的时间让它发挥作用,希望它能帮助到别人。我目前有一个Opencart 2.2,SSL/https适用于所有页面。(糟透了,真烦人)。。我正在使用Fastor主题,并拥有SEO Pack Pro、vQMOD和其他几个MOD和扩展。

以下是我所做的:1.安装v2.2.0.x Changes.zip不要将VQMOD更新到2.6.1(终止了我的安装)不要安装VQMOD Manager 3.0(也扼杀了我的安装)。只需手动安装。谷歌,如果你需要的话。

  1. 然后安装此扩展不,我不会读西班牙语,但我查看了xml文件,它在多个页面中将site_ssl设置为true,这是论坛深处建议手动执行的。这使得签出/签出和信息页面也能正常工作。

  2. 管理面板>设置>安全>使用SSL

  3. 修改SEO/SSL/WWW的.haccess(我得到了该网站的WWW证书,因为我希望整个网站都是SSL)。替换您应该在haccess文件中看到的seo重写块:

区块报价

#SEO URL Settings
RewriteEngine On
#If your opencart installation does not run on the main web folder make    sure you folder it does run in ie. / becomes /shop/
RewriteBase /
RewriteRule ^sitemap.xml$ index.php?route=feed/google_sitemap [L]
RewriteRule ^googlebase.xml$ index.php?route=feed/google_base [L]
RewriteRule ^system/download/(.*) index.php?route=error/not_found [L]
RewriteCond %{HTTP_HOST} !^www'. [NC]
RewriteRule ^(.*)$ https://www.example.com/$1 [L,R=302]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_URI} !.*'.(ico|gif|jpg|jpeg|png|js|css)
RewriteRule ^([^?]*) index.php?_route_=$1 [QSA]
RewriteCond %{SERVER_PORT} ^80$
RewriteRule ^.*$ https://%{SERVER_NAME}%{REQUEST_URI} [R=302,L]
  1. 修改config.php和admin/config.php。将所有设置为http->https

区块报价

config.php
// HTTP
define('HTTP_SERVER', 'https://www.example.com/');
// HTTPS
define('HTTPS_SERVER', 'https://www.example.com/');
admin/config.php
// HTTP
define('HTTP_SERVER', 'https://www.example.com/admin/');
define('HTTP_CATALOG', 'https://www.example.com/');
// HTTPS
define('HTTPS_SERVER', 'https://www.example.com/admin/');
define('HTTPS_CATALOG', 'https://www.example.com/');
  1. 在测试之前清除你的mod缓存和浏览器缓存/临时文件

我制作的其他手动修复:货币/货币修复货币/货币"修复"对我不起作用。如果货币兑换商破坏了你的SSL,你可以尝试修复或通过删除view/common/currency.tpl中的所有代码来删除它。备份,然后清空代码。

未加载图像/CSS尝试此修复程序:我也手动修复了这个问题,不知道v2.2.0 Changes.zip是否得到了这个:

区块报价

SEO/SSL cant load page
Open catalog/controller/startup/startup.php
and after
$this->config->set('config_url', HTTP_SERVER);
add
$this->config->set('config_ssl', HTTPS_SERVER);

您的管理有变化吗?在管理面板>设置>安全使可能使用SSL

好的,这是我刚刚做的:https显示错误,我添加到购物车等-不起作用。我必须在管理员的站点设置中启用ssl,标准,然后我在记事本中检查了我的header.tpl文件,点击编辑找到HTTP,并将两个条目更改为HTTPS

<meta https-equiv="X-UA-Compatible" content="IE=edge">

以及我早些时候在html中为标题添加的图像文件的dir,这将其指向http://mywebsite url

这两件事导致了这个错误。当我将文件ftp'd返回到网站时,它在FirefoxIE中运行良好。我是一个完全的编码新手,但这是显而易见的(在去掉一些头发之后),所以只需检查您的头文件,并将每个http更改为https。交叉你的手指和脚趾。

这意味着安装opencart whiout vqmod并使用解决方案,然后安装vqmod