【问题标题】:mod_rewrite is enabled, .htaccess file is ok, but requests are not going through index.phpmod_rewrite 已启用,.htaccess 文件正常,但请求未通过 index.php
【发布时间】:2017-08-17 15:19:15
【问题描述】:

我刚刚安装了 ubuntu-server_6.04.2_LTS,全新安装后我启用了 mod_rewrite,它显示在 phpinfo() 我的 .htaccess 文件没问题 但是,请求仍然没有通过 index.php

【问题讨论】:

  • 产生什么类型的错误或它是如何失败的?检查错误日志和 Alex 给出的答案。如果您没有在 htaccess 中使用 rewirteBase,请检查 config.php 中的 base_url。
  • 没有错误,但是如果URL中没有描述index.php,我需要输入domain.tld/ci/index.php/controller/method,CodeIniter错误404没有显示,默认apache错误显示 404 页面。

标签: .htaccess codeigniter mod-rewrite apache2


【解决方案1】:

您应该检查对于该特定目录(项目的根文件夹),apache 是否配置为允许通过 .htaccess 覆盖。

如果您想允许这样的覆盖,apache.conf 中的指令或虚拟主机的特定设置应如下所示:

<Directory /var/www/>
    AllowOverride All
    Require all granted
</Directory>

【讨论】:

    猜你喜欢
    • 2011-06-16
    • 2013-05-21
    • 1970-01-01
    • 1970-01-01
    • 2011-08-12
    • 2016-09-08
    • 1970-01-01
    • 1970-01-01
    • 2013-10-26
    相关资源
    最近更新 更多