Codeigniter显示404页面在Hostgator上找不到 [英] Codeigniter showing 404 Page Not Found on Hostgator
问题描述
我目前正在我自己的Hostgator帐户上测试我的Codeigniter项目。该项目在我的WAMP服务器上正常工作,但它显示一个404页面未找到错误时在Hostgator上线。我试着玩的文件权限在FTP上玩.htaccess文件。当前网站可以在这里查看:www.test.jeffreyteruel.com。
I'm currently testing my Codeigniter Project on my own Hostgator account. The project works well on my WAMP server but it shows a 404 Page Not Found error when online on Hostgator. I've tried playing around with the file permissions on FTP to playing around with the .htaccess file. The current site can be viewed here: www.test.jeffreyteruel.com.
下面是我的.htaccess文件:
Here's a look at my .htaccess file:
RewriteEngine on
RewriteCond $1 !^(index\.php|resources|robots\.txt)
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ index.php/$1 [L,QSA]
结构:
-application
-assets (css/js/img files)
-cgi-bin(from the server)
-system
-uploads
-.htaccess
-index.php
这是我当前的config.php信息:
Here's my current config.php info:
$config['base_url'] = 'http://test.jeffreyteruel.com';
$config['index_page'] = '';
$config['uri_protocol'] = 'AUTO';
route.php文件中的默认控制器是:$ route ['default_controller'] ='main ';
The default controller on the route.php file is: $route['default_controller'] = 'main';
主控制器(main.php):
Main Controller (main.php):
<?php defined('BASEPATH') OR exit('No direct script access allowed');
class Main extends CI_Controller {
public function __construct()
{
parent::__construct();
//insert model here
$this->load->model('main_model');
date_default_timezone_set('Asia/Manila');
}
public function index()
{
$content['main_content'] = 'home/home';
$this->load->view('main',$content);
}
...
?>
任何帮助使网站正常显示将不胜感激。
Any help to get the site showing properly would be appreciated.
推荐答案
我有CI运行在Hostgator的子域上,我记得有点困难让它工作,
I have CI running on a subdomain on Hostgator and I recall a slight struggle getting it working but as I'm old I've got a memory like a.... Hmmm can't remember!
我的简体中文.htaccess是
My Simplified .htaccess is
RewriteEngine On
RewriteBase /
# request to index.php
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ index.php/$1 [L]
添加:
在您的config.php中
In your config.php
$config['base_url'] = 'http://test.jeffreyteruel.com';
添加尾部/
$config['base_url'] = 'http://test.jeffreyteruel.com/';
更新:
类名需要是Capitialized - 第一个字母Uppercased(ucfirst)。
参考: codeigniter.com/userguide3/general/styleguide.html #file-naming
With Codeigniter 3 All Class names need to be Capitialized - First letter Uppercased ( ucfirst ). Refer to : codeigniter.com/userguide3/general/styleguide.html#file-naming
这篇关于Codeigniter显示404页面在Hostgator上找不到的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!