2016-11-21 116 views
0

我一直在寻找很多,并测试了几种不同的方法来解决这个问题......但目前为止没有任何工作。我刚刚上传了一个网站到我的服务器,经过所有必要的更改后,它返回了以下错误 - 我以前从未见过。Codeigniter 1.7.2 404页未找到

This is the screen shot when I first uploaded the files online...

嗯,有些测试和研究后,我改变了我的控制器的名字都大写 - 和模型 - 和页面停止的“PHP”部分显示出来。

这里是我的设立:

FOLDER:网站是一个文件夹/工地内/

application/ 
favicon/ 
system/ 
index.php 
.htaccess 
robots.txt 

控制器:我测试过更改为是CI_Controller - 即使我工作CI 1.7.2 - 和__construct()...没有工作

class Home extends Controller 
{ 

    // SET LAYOUT DEFAULT 
    public $layout = 'default'; 

    // SET TITLE DEFAULT 
    public $title = ''; 

    // SET CSS DEFAULT 
    public $css = array('scripts/fancybox/jquery.fancybox'); 

    // SET JAVASCRIPT DEFAULT 
    public $js = array('scripts/fancybox/jquery.fancybox.pack'); 

    function Home() { 

     parent :: Controller(); 

     // LOAD Libraries 
     $this->load->library(array('createdate','minitextile','showimages')); 

     // LOAD Models 
     $this->load->model('site_model'); 
    } 

    function index() { 

     $data['website_info'] = $this->config->item('w_infos'); 
     // LOAD VIEWS 
     $this->load->view ('include/home_view', $data); 
    } 
} 

CONFIG - 我已经把只有在这里呈香...

$config['base_url'] = "http://domain.com/site/"; 

$config['index_page'] = ""; 

$config['uri_protocol'] = "REQUEST_URI"; // Tested with AUTO, didn't work 

$config['enable_hooks'] = TRUE; 

$config['permitted_uri_chars'] = 'a-z 0-9~%.:_\-'; 

$config['enable_query_strings'] = FALSE; 
$config['controller_trigger'] = 'c'; 
$config['function_trigger']  = 'm'; 
$config['directory_trigger'] = 'd'; 

的.htaccess - 该文件是基于文件夹/工地内/

<IfModule mod_rewrite.c> 

    RewriteEngine on 
    RewriteBase /site/ 
    RewriteCond %{REQUEST_FILENAME} !-f 
    RewriteCond %{REQUEST_FILENAME} !-d 
    RewriteRule ^(.*)$ index.php?/$1 [L] 

</IfModule> 

<IfModule !mod_rewrite.c> 
    # Without mod_rewrite, route 404's to the front controller 
    ErrorDocument 404 /index.php 
</IfModule> 

途径:

$route['default_controller'] = "home"; 

我的日志:这是控制器更名

DEBUG - 2016-11-21 15:54:22 --> Config Class Initialized 
DEBUG - 2016-11-21 15:54:22 --> Hooks Class Initialized 
DEBUG - 2016-11-21 15:54:22 --> URI Class Initialized 
ERROR - 2016-11-21 15:54:22 --> 404 Page Not Found --> home 

名称变更(到帽子的)之前,它是这样的:

DEBUG - 2016-11-21 14:08:28 --> Config Class Initialized 
DEBUG - 2016-11-21 14:08:28 --> Hooks Class Initialized 
DEBUG - 2016-11-21 14:08:28 --> URI Class Initialized 
DEBUG - 2016-11-21 14:08:28 --> No URI present. Default controller set. 
DEBUG - 2016-11-21 14:08:28 --> Router Class Initialized 
DEBUG - 2016-11-21 14:08:28 --> Output Class Initialized 
DEBUG - 2016-11-21 14:08:28 --> Input Class Initialized 
DEBUG - 2016-11-21 14:08:28 --> Global POST and COOKIE data sanitized 
DEBUG - 2016-11-21 14:08:28 --> Language Class Initialized 
ERROR - 2016-11-21 14:08:28 --> 404 Page Not Found --> home/index 

我知道,我是新的,并且有很多帖子这个问题在那里......我只是在做了一些(很多)测试我的自我之后问 - 至少就我的知识而言:D我一直在使用这个CI版本并设置了一段时间 - 并且意义重大升级到CI 3 - 我已经测试/改变了我可以想象的所有东西,并且面临着许多不同的主机/服务器,但我仍然无法找到解决方法。

回答

1

这可能是因为

function Home() { 

    parent :: Controller(); 

    // LOAD Libraries 
    $this->load->library(array('createdate','minitextile','showimages')); 

    // LOAD Models 
    $this->load->model('site_model'); 
} 

应该http://www.codeigniter.com/user_guide/general/controllers.html#class-constructors

function __construct() { 

    parent::__construct(); 

    // LOAD Libraries 
    $this->load->library(array('createdate','minitextile','showimages')); 

    // LOAD Models 
    $this->load->model('site_model'); 
} 

确保您的文件名称更正也升级Home.php时仅第一个字母大写。如此处所述

+0

你的意思是'parent :: __ construct();',对吧? ;-) –

+0

@RocketHazmat哎呀错别字它现在已修复 – user4419336

+0

感谢您的提示! – ArtFranco

0

想通了!感谢您的帮助......但这是PHP配置的问题...... short_open_tag未在服务器上激活......并花了我一段时间才看到它! :p所以提示:检查一些PHP的配置了。