将CI上载到服务器时出现404错误

时间:2018-03-26 16:35:55

标签: codeigniter

托管我的CI项目时遇到错误,它在localhost中成功。我改变了我的意见 旧 $ config ['base_url'] ='http://localhost:8000/myweb';在config.php中 新 $ config ['base_url'] ='http://myweb.com';

的.htaccess

 RewriteEngine On
 RewriteCond %{REQUEST_FILENAME} !-f
 RewriteCond %{REQUEST_FILENAME} !-d
 RewriteRule ^(.*)$ index.php/$1 [L]

这是错误: 404页面不存在 找不到您请求的页面。

我错过了什么吗?

1 个答案:

答案 0 :(得分:0)

确保在Apache服务器的情况下启用了mod_rewrite!

启用mod_rewrite:

a2enmod rewrite

然后:

service apache2 restart

在application / config / config.php中设置:

$config['index_page'] = '';

.htaccess例证:

<IfModule mod_rewrite.c>
RewriteEngine On
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ index.php/$1 [L]
</IfModule>
相关问题