【问题标题】:Codeigniter .htaccess not working, show "500 Internal Server Error" messege [duplicate]Codeigniter .htaccess 不工作,显示“500 Internal Server Error”消息[重复]
【发布时间】:2013-04-05 18:47:35
【问题描述】:

我正在使用 wamp,并且在我的 www 文件夹中,我在文件夹名称 ci 下安装了 codeigniter。在使用 .htaccess 之前,我的 codeigniter 工作正常,运行项目时我可以看到 codeigniter 欢迎消息。在 ci 目录中创建 .htaccess 文件后,运行项目时总是收到“500 Internal Server Error”。 这是我的 config.php 文件的一部分-

    $config['base_url'] = 'http://localhost/ci/';
    $config['index_page'] = '';
    $config['uri_protocol'] = 'REQUEST_URI';

这是我的 .htaccess 文件-

    <IfModule mod_rewrite.c>
    RewriteEngine on
    RewriteBase /ci/
    RewriteCond %{REQUEST_FILENAME} !-f
    RewriteCond %{REQUEST_FILENAME} !-d
    RewriteRule ^(.*)$ index.php/$1 [L]
    </IfModule>

这是我的 apache 错误日志消息-

    [Sat Apr 06 00:04:47 2013] [alert] [client 127.0.0.1] C:/wamp/www/ci/.htaccess: RewriteEngine not allowed here, referer: http://localhost/

我还在 apache 中启用了 rewrite_module。 现在我还能做什么?我希望有人帮助我

注意我的 codeigniter 版本 2.1.3,Apache 版本:2.2.11,PHP 版本:5.3.1,MySQL 版本:5.1.32

【问题讨论】:

  • 错误非常明显,如果您愿意检查Apache docs,您会看到该指令在哪里被允许。
  • 我认为您在 Apache 配置中缺少该目录的 AllowOverride All
  • 现在我设置 AllowOverride All。还是不行
  • 这个类型的问题被回答了很多次,但是这些回答都没有解决我的问题
  • 我遇到了这个问题,因为我的 .htaccess 文件与我的 index.php 不在同一目录中。仔细检查这个

标签: php .htaccess codeigniter


【解决方案1】:

您需要在ci 目录上下文中的AllowOverride All

<Directory /path/to/ci>
    Options FollowSymLinks
    AllowOverride all
    # any other options/directives needed
</Directory>

【讨论】:

    猜你喜欢
    • 2023-03-30
    • 1970-01-01
    • 2015-12-29
    • 1970-01-01
    • 2021-10-07
    相关资源
    最近更新 更多