dongxia4880 2013-11-12 10:34
浏览 36
已采纳

使用PHP CGI在根域上的CodeIgniter错误404

So, today I upgrade PHP and apache on my server to version PHP 5.4 and Apache 2.4. And then I noticed on one domain using older version of codeigniter (I've try to echo CI_VERSION but it shows nothing) is showing error 404 on the root domain. But typing domain.com/home works fine. (home is my default controller). Typing any other controller also working fine. But domain.com shown error 404.

.htaccess

<IfModule mod_rewrite.c>
    Options +FollowSymLinks
    RewriteEngine On
    RewriteBase /

    #'system' can be replaced if you have renamed your system folder.
    RewriteCond %{REQUEST_URI} ^system.*
    RewriteRule ^(.*)$ index.php/$1 [L]

    #Checks to see if the user is attempting to access a valid file,
    #such as an image or css document, if this isn't true it sends the
    #request to index.php
    RewriteCond %{REQUEST_FILENAME} !-f
    RewriteCond %{REQUEST_FILENAME} !-d
    RewriteRule ^(.*)$ index.php/$1 [L]

    #This last condition enables access to the images and css folders, and the robots.txt file
    RewriteCond $1 !^(index\.php|apc\.php|assets|nivo-slider|hr|stm|elearning|docs|adminer|favicon\.ico|file|flash|tinymce|robots\.txt)
    RewriteRule ^(.*)$ index.php/$1 [L]
</IfModule>

<IfModule !mod_rewrite.c>
    # If we don't have mod_rewrite installed, all 404's
    # can be sent to index.php, and everything works as normal.
    ErrorDocument 404 /application/errors/404.php
</IfModule>

config.php

$config['base_url'] = "http://".$_SERVER['HTTP_HOST'];
$config['index_page'] = "";
$config['uri_protocol'] = "AUTO";

routes.php

$route["default_controller"]    = "home";
$route["error_controller"]      = "error";
$route['scaffolding_trigger'] = "";

I've trying change uri_protocol to QUERY_STRING & REQUEST_URI but still not working.

  • 写回答

1条回答 默认 最新

  • douchi0028 2013-11-12 10:45
    关注

    I managed to solve this problem by adding DirectoryIndex home on my .htaccess.

    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论

报告相同问题?

悬赏问题

  • ¥15 有偿求跨组件数据流路径图
  • ¥15 写一个方法checkPerson,入参实体类Person,出参布尔值
  • ¥15 我想咨询一下路面纹理三维点云数据处理的一些问题,上传的坐标文件里是怎么对无序点进行编号的,以及xy坐标在处理的时候是进行整体模型分片处理的吗
  • ¥15 CSAPPattacklab
  • ¥15 一直显示正在等待HID—ISP
  • ¥15 Python turtle 画图
  • ¥15 关于大棚监测的pcb板设计
  • ¥15 stm32开发clion时遇到的编译问题
  • ¥15 lna设计 源简并电感型共源放大器
  • ¥15 如何用Labview在myRIO上做LCD显示?(语言-开发语言)