我使用https时不会删除index.php,但它适用于http.我需要做的是我的网站正常工作,例如它适用于http和https.任何遇到同样问题的人都会帮我解决这个问题.
例如:在http
在https
1)https://xyz.mydomain.com/users/login //未找到404页
2)https://xyz.mydomain.com/index.php/users/login //工作正常
我的htaccess代码
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ index.php/$1 [L]
</IfModule>
Run Code Online (Sandbox Code Playgroud)
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;
Run Code Online (Sandbox Code Playgroud)