【问题标题】:https issue in opencartopencart中的https问题
【发布时间】:2017-12-19 07:17:12
【问题描述】:

我已经在我的网站中完成了安全安全(https),如果我打开我的网站意味着它显示为(http://www.kuberansilks.in/),但是当我在浏览器中打开它时,它会自动采用 https 安全协议, 并且网址看起来像(https://www.kuberansilks.in)。那么,我该如何避免这个问题,请帮助我(我正在使用 AWS 服务器)。

下面我的htaccess代码请查看:

RewriteEngine On
RewriteBase /
RewriteCond %{HTTP_HOST} ^kuberansilks\.in [NC]
RewriteCond %{SERVER_PORT} 80 
RewriteRule ^(.*)$ https://www.kuberansilks.in/$1 [R,L]
RewriteRule ^sitemap.xml$ index.php?route=feed/google_sitemap [L]
RewriteRule ^googlebase.xml$ index.php?route=extension/feed/google_base [L]
RewriteRule ^system/storage/(.*) 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]   

【问题讨论】:

    标签: php html .htaccess opencart


    【解决方案1】:

    使用以下代码更新您的 ht-access 文件

    RewriteEngine On
    RewriteBase /
    RewriteCond %{HTTP_HOST} ^kuberansilks\.in [NC]
    
    //Added lines
    RewriteRule ^ https://%1%{REQUEST_URI} [NE,L,R=301]
    RewriteCond %{HTTPS} off
    RewriteRule ^ https://%{HTTP_HOST}%{REQUEST_URI} [NE,L,R=301] 
    
    
    RewriteCond %{SERVER_PORT} 80 
    RewriteRule ^(.*)$ https://www.kuberansilks.in/$1 [R,L]
    RewriteRule ^sitemap.xml$ index.php?route=feed/google_sitemap [L]
    RewriteRule ^googlebase.xml$ index.php?route=extension/feed/google_base [L]
    RewriteRule ^system/storage/(.*) 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]
    

    更新代码:

    RewriteEngine On 
    RewriteCond %{HTTPS} !=off
    RewriteRule ^/?(checkout|account|admin) https://%{HTTP_HOST}%{REQUEST_URI} [R=301,L]
    RewriteCond %{SERVER_PORT} 80 
    RewriteCond %{HTTP_HOST} ^site\.co\.uk [NC] 
    RewriteRule ^(.*)$ https://www.site.co.uk/$1 [R,L]
    
    
    config.php
    // HTTP
    define('HTTP_SERVER', 'https://www.site.co.uk/');
    // HTTPS
    define('HTTPS_SERVER', 'https://www.site.co.uk/');
    define('HTTPS_IMAGE', 'https://www.site.co.uk/image/');
    
    /admin/config.php
    // HTTP
    define('HTTP_SERVER', 'https://www.site.co.uk/admin/');
    define('HTTP_CATALOG', 'https://www.site.co.uk/');
    
    // HTTPS
    define('HTTPS_SERVER', 'https://www.site.co.uk/admin/');
    define('HTTPS_CATALOG', 'https://www.site.co.uk/');
    define('HTTPS_IMAGE', 'https://www.site.co.uk/image/');
    

    请检查它应该可以工作。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 2015-03-25
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多