【问题标题】:Codeigniter 3, works on 'http' but not on 'https'Codeigniter 3,适用于“http”但不适用于“https”
【发布时间】:2019-02-28 23:18:00
【问题描述】:

我的 htaccess

重写引擎开启 RewriteBase / RewriteCond $1 !^(index\.php|uploads|images|ws|vendor|css|js|robots\.txt) 重写规则 ^(.*)$ /index.php/$1 [L]

我还隐藏了我的 index.php

加载失败:- https://www.abc.in/abc-xyz-fdg

作品:- https://www.abc.in/index.php/abc-xyz-fdg

【问题讨论】:

标签: php codeigniter .htaccess


【解决方案1】:

试试这个

RewriteCond %{HTTPS} !on
RewriteRule (.*) https://%{HTTP_HOST}%{REQUEST_URI}

【讨论】:

    【解决方案2】:

    您需要对两个文件进行更改。

    1. config.php文件$config['secure_base_url']=" https://www.abc.in/";

    2. 然后打开url_helper.php文件(system/helpers/url_helper.php)并修改https://sajjadhossain.com/2008/10/27/ssl-https-urls-and-codeigniter/中的代码

    3. 现在,在Config.php 文件(system/Core/Config.php) 中添加以下代码,如https://sajjadhossain.com/2008/10/27/ssl-https-urls-and-codeigniter/ 中一样

    reference

    【讨论】:

    • (system/libraries/Config.php)我没有这个文件?
    • 您使用的是哪个版本的 CI?
    • 如果您使用的是最新版本 v3.1.9,那么它将位于system/Core/Config.php
    • 我正在使用 3.1.9。我刚刚下载了一个新版本的 CI 来检查我的文件是否丢失。它不在新的下载中。
    • 我做了必要的更改,但仍然没有帮助
    【解决方案3】:

    这对我有用。

    第 1 步

    SSL 配置(使用 https 运行)

       允许覆盖所有
    目录>

    第 2 步

    .htaccess 文件应该是这样的...

    RewriteEngine On
    RewriteCond %{HTTPS} !=on      
    RewriteRule ^ https://%{HTTP_HOST}%{REQUEST_URI} [L,R=301]
    
    <IfModule mod_rewrite.c>
        RewriteEngine on
        RewriteCond %{REQUEST_FILENAME} !-f
        RewriteCond %{REQUEST_FILENAME} !-d
        RewriteRule ^ index.php [L]
    </IfModule> 
    

    参考链接: HTTPS and Remove index.php on CodeIgniter

    感谢那些尝试过我的人

    编码愉快!!

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2014-08-15
      • 1970-01-01
      • 2015-01-05
      • 2018-07-20
      • 2013-11-30
      • 1970-01-01
      • 2015-09-06
      • 1970-01-01
      相关资源
      最近更新 更多