它在localhost上运行正常。但是当我在webhost上传文件时,它不会重定向到默认控制器。但是,通过手动输入URL,它会加载页面。我们必须考虑加载默认控制器吗?
这是我的.htaccess
<IfModule mod_rewrite.c>
RewriteEngine On
# Set the rewritebase to your CI installation folder
RewriteBase /
# Send everything to index.php
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ index.php/$1 [L]
</IfModule>
我在config.php中设置了baseurl
$config['base_url'] = 'http://'.$_SERVER['SERVER_NAME'];
$config['index_page'] = 'index';
这是我的routes.php
$route['default_controller'] = "Home"; // Home is my default controller
$route['404_override'] = '';
答案 0 :(得分:0)
将以下代码替换为config.php
发件人:
$config['index_page'] = 'index';
收件人:
$config['index_page'] = '';