【问题标题】:404 error when Uploading CI to Server将 CI 上传到服务器时出现 404 错误
【发布时间】:2018-03-26 16:35:54
【问题描述】:

我在托管我的 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】:

    确保 mod_rewrite 已启用,以防 Apache 服务器!

    启用 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>
    

    【讨论】:

    • 已解决,这不是我的问题。谢谢回答
    • 出了什么问题?
    • 大写字母
    猜你喜欢
    • 2016-11-13
    • 2017-12-12
    • 1970-01-01
    • 2018-05-03
    • 1970-01-01
    • 1970-01-01
    • 2016-02-28
    • 2017-01-16
    • 1970-01-01
    相关资源
    最近更新 更多