【发布时间】:2023-03-27 18:30:01
【问题描述】:
我在我的 codeigniter 网站中安装了 ssl,该网站是实时的,我还启用了强制 https 选项,我的主机是托管商,SSL 颁发者:Let's Encrypt Authority X3。
这里的问题是,当用户第一次访问该网站时,它在没有 SSL 的情况下显示“不安全”,然后如果您转到另一个页面显示 SSL,然后如果您再次访问主页,则 SSL 存在,问题出在第一次使用浏览器的搜索栏访问,每次使用浏览器的搜索栏都会出现这种情况,任何设备和浏览器都是这样。
下面的实时 URL 是我的 config.php:
<?php
defined('BASEPATH') OR exit('No direct script access allowed');
$config['base_url'] = '';
$config['index_page'] = '';
$config['uri_protocol'] = 'REQUEST_URI';
$config['url_suffix'] = '';
$config['language'] = 'english';
$config['charset'] = 'UTF-8';
$config['enable_hooks'] = FALSE;
$config['subclass_prefix'] = 'MY_';
$config['composer_autoload'] = FALSE;
$config['permitted_uri_chars'] = 'a-z 0-9~%.:_\-';
$config['enable_query_strings'] = FALSE;
$config['controller_trigger'] = 'c';
$config['function_trigger'] = 'm';
$config['directory_trigger'] = 'd';
$config['allow_get_array'] = TRUE;
$config['log_threshold'] = 0;
$config['log_path'] = '';
$config['log_file_extension'] = '';
$config['log_file_permissions'] = 0644;
$config['log_date_format'] = 'Y-m-d H:i:s';
$config['error_views_path'] = '';
$config['cache_path'] = '';
$config['cache_query_string'] = FALSE;
$config['encryption_key'] = '';
$config['sess_driver'] = 'files';
$config['sess_cookie_name'] = 'ci_session';
$config['sess_expiration'] = 7200;
$config['sess_save_path'] = NULL;
$config['sess_match_ip'] = FALSE;
$config['sess_time_to_update'] = 300;
$config['sess_regenerate_destroy'] = FALSE;
$config['cookie_prefix'] = '';
$config['cookie_domain'] = '';
$config['cookie_path'] = '/';
$config['cookie_secure'] = FALSE;
$config['cookie_httponly'] = FALSE;
$config['standardize_newlines'] = FALSE;
$config['global_xss_filtering'] = FALSE;
$config['csrf_protection'] = FALSE;
$config['csrf_token_name'] = 'csrf_test_name';
$config['csrf_cookie_name'] = 'csrf_cookie_name';
$config['csrf_expire'] = 7200;
$config['csrf_regenerate'] = TRUE;
$config['csrf_exclude_uris'] = array();
$config['compress_output'] = FALSE;
$config['time_reference'] = 'local';
$config['rewrite_short_tags'] = FALSE;
$config['proxy_ips'] = '';
这是我的 htaccess 代码:
RewriteEngine On
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ index.php/$1 [L]
谁能告诉我这里有什么问题,提前谢谢
【问题讨论】:
-
“我已启用强制 https 选项” - 在哪里以及如何?
-
@MagnusEriksson,在托管程序中有一个强制 https 选项
-
那么这似乎是您的托管公司方面的问题。您的网站允许所有页面使用 http 和 https。当您通过单击该站点单击转到其他页面时,它似乎起作用的唯一原因是因为您在链接中有 https。您可以在任何页面上将 https 更改为 http,它会在没有 https 的情况下显示它。
-
@MagnusEriksson 反正在 htaccess 中,我可以强制它到 https
-
@MagnusEriksson 是的,它现在似乎可以工作了
标签: php codeigniter security ssl config