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

问题描述 投票:0回答:1

托管我的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找不到页面找不到您请求的页面。

我错过了什么?

codeigniter
1个回答
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>
© www.soinside.com 2019 - 2024. All rights reserved.