index.php没有删除https CodeIgniter
发布时间:2020-12-13 13:24:23 所属栏目:PHP教程 来源:网络整理
导读:我使用https时,index.php没有删除,但它适用于http. 我需要做的是我的网站正常工作,例如它适用于http和https.任何遇到同样问题的人都会帮我解决这个问题. 例如:在http http://xyz.mydomain.com/users/login //工作正常 http://xyz.mydomain.com/index.php/us
我使用https时,index.php没有删除,但它适用于http.
我需要做的是我的网站正常工作,例如它适用于http和https.任何遇到同样问题的人都会帮我解决这个问题. 例如:在http > http://xyz.mydomain.com/users/login //工作正常 在https 1)https://xyz.mydomain.com/users/login //找不到404页面 我的htaccess代码 <IfModule mod_rewrite.c> RewriteEngine On RewriteCond %{REQUEST_FILENAME} !-f RewriteCond %{REQUEST_FILENAME} !-d RewriteRule ^(.*)$index.php/$1 [L] </IfModule> config.php文件 $root=(isset($_SERVER['HTTPS']) ? "https://" : "http://").$_SERVER['HTTP_HOST']; $root.= str_replace(basename($_SERVER['SCRIPT_NAME']),'',$_SERVER['SCRIPT_NAME']); $config['base_url'] = $root;
似乎您的主机文件中存在问题.
如果您使用的是apache,请更改您的主机文件; <VirtualHost *:443> ServerAdmin admin@example.com DocumentRoot /path ServerName xyz.mydomain.com ServerAlias www.xyz.mydomain.com SSLEngine On SSLOptions +StrictRequire SSLCertificateFile /path to ssl file/mydomain.crt SSLCertificateKeyFile /path to ssl file/mydomain.key SSLProtocol TLSv1 <Directory "/path"> Require all granted Options -FollowSymLinks -Includes -ExecCGI -Indexes AllowOverride All Order allow,deny Allow from all </Directory> RewriteEngine On </VirtualHost> 现在为您的htaccess文件添加如下内容: <IfModule mod_rewrite.c> Options +FollowSymLinks RewriteEngine On RewriteCond %{SERVER_PORT} 80 RewriteRule ^(.*)$https://xyz.mydomain.com/$1 [R=301,L] RewriteCond %{REQUEST_FILENAME} !-f RewriteCond %{REQUEST_FILENAME} !-d RewriteRule ^(.*)$index.php/$1 [L] </IfModule> 快乐编码:) (编辑:李大同) 【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容! |