【发布时间】:2023-03-09 00:34:01
【问题描述】:
我目前正在我自己的 Hostgator 帐户上测试我的 Codeigniter 项目。该项目在我的 WAMP 服务器上运行良好,但在 Hostgator 上在线时显示 404 Page Not Found 错误。我尝试过使用 FTP 上的文件权限来使用 .htaccess 文件。当前站点可以在这里查看:www.test.jeffreyteruel.com。
看看我的 .htaccess 文件:
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 信息:
$config['base_url'] = 'http://test.jeffreyteruel.com';
$config['index_page'] = '';
$config['uri_protocol'] = 'AUTO';
route.php 文件中的默认控制器是:$route['default_controller'] = 'main';
主控制器(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);
}
...
?>
任何帮助使网站正常显示将不胜感激。
【问题讨论】:
-
如果你转到
http://example.com/index.php是否正确解决? -
@Ohgodwhy 不。如果我转到您提到的链接,我会收到此消息:示例域 该域的建立是为了用于文档中的说明性示例。您可以在示例中使用此域,无需事先协调或请求许可。
-
@jeffrey Teruel Ohgodwhy 的意思是......如果你去test.jeffreyteruel.com/index.php 你会看到什么?由于它是一个实时站点,我们看到您找不到 404 页面。 jeffreyteruel.com/test/index.php 给出相同的结果。
-
@TimBrownlaw,我仍然遇到同样的 404 错误。既然是子域,我会检查如果我把它放在它自己的域上是否有任何区别。
-
你在 routes.php 中的默认路由是什么。你有任何大写的文件夹名称吗?如果您禁用 .htaccess 并使用上面的完整链接会发生什么?
标签: php .htaccess codeigniter http-status-code-404 server