加入收藏 | 设为首页 | 会员中心 | 我要投稿 李大同 (https://www.lidatong.com.cn/)- 科技、建站、经验、云计算、5G、大数据,站长网!
当前位置: 首页 > 站长学院 > PHP教程 > 正文

php – 所有请求的Opencart 2.2.x ssl

发布时间:2020-12-13 17:50:00 所属栏目:PHP教程 来源:网络整理
导读:我安装opencart最新版本,我想为网址启用所有ssl 在管理员设置SSL启用 在config.php中,管理员和类别都更改为https htaccess的 RewriteEngine OnRewriteBase /RewriteRule ^sitemap.xml$index.php?route=feed/google_sitemap [L]RewriteRule ^googlebase.xml$i
我安装opencart最新版本,我想为网址启用所有ssl

在管理员设置SSL启用

在config.php中,管理员和类别都更改为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]

但当网址不是搜索引擎优化时,它的工作原理与搜索引擎优化它不起作用
网址将是
https://www.localhost/index.php?route=desktops/mac

如何改变
https://www.localhost/desktops/mac

解决方法

我还安装了opencart 2.2.

我尝试了https的扩展,但它崩溃了一切;(

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

??1??
在.htaccess中:最后添加

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

??2??
在root admin中的config.php中

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

// HTTPS
define('HTTPS_SERVER','https://www.__your_domain__.com/store/');

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

??3??
在system / library / url中
修改http到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;
        }

(编辑:李大同)

【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容!

    推荐文章
      热点阅读