【问题标题】:Removing index.php in CodeIgniter using .htaccess file on live server [duplicate]使用实时服务器上的 .htaccess 文件删除 CodeIgniter 中的 index.php [重复]
【发布时间】:2017-06-02 10:08:12
【问题描述】:

我的 codeigniter 项目在开发服务器上正常运行,但是当我在实时服务器上迁移它时,我遇到了 .htaccess 文件的问题。我无法删除 index.php 文件。它给出了一个错误 404 not found。

【问题讨论】:

  • 确保您的服务器配置为使用 .htaccess 文件。
  • 您的生产服务器是否启用了模式重写?
  • 如果您认为这是问题所在,请注意发布.htaccess 代码?

标签: php codeigniter controller codeigniter-3 remote-server


【解决方案1】:

最后,我解决了这个问题,请按照以下步骤操作。

  1. 只需按照 CodeIgniter 用户指南中的步骤操作 - 从 url 中删除 index.php。
  2. 在应用程序和系统文件夹所在的根目录中添加 .htaccess。
  3. 设置 $config['base_url'] = 'http:/你的域 IP/ci 文件夹名称'; 注意:路径 - ..config/config.php
  4. 设置 $config['index_page'] = ""; 注意:路径 - ..config/config.php
  5. 小鬼。在 httpd.conf 文件中添加以下代码。

    Options Indexes FollowSymLinks MultiViews
    AllowOverride All
    Order allow,deny
    allow from all
    

    并重新启动服务器。固定。

【讨论】:

猜你喜欢
  • 2014-11-25
  • 2013-03-07
  • 1970-01-01
  • 1970-01-01
  • 2014-02-10
  • 2016-04-15
  • 2015-03-09
  • 2019-04-06
  • 2023-03-16
相关资源
最近更新 更多