【发布时间】:2015-04-06 13:08:39
【问题描述】:
正如标题所说,我已经搜索了很多,尝试了一些修复,但它仍然无法在在线服务器上运行。在线 我一直收到 404 找不到页面。当它在本地运行时,它就像一个魅力。
目前这是我的配置。
public_html/application/config/config.php:
$config['base_url'] = '';
$config['index_page'] = '';
$config['uri_protocol'] = 'AUTO';
我已尝试将 base_url 更改为站点域:http://junkfoodmountain.com/
尝试将 index_page 更改为 index.php 并且什么都没有
尝试将 uri_protocol 更改为其他所有可能的协议。
public_html/.htaccess
Options -Indexes
RewriteEngine on
RewriteBase /
RewriteCond $1 !^(index\.php|assets|phpmyadmin|robots\.txt)
RewriteRule ^(.*)$ /index.php?/$1 [QSA,L]
尝试不使用 .htaccess 也不起作用。
该服务器是带有 virtualmin 的 Ubuntu Server 14.04 LTS。对此的所有配置都是默认的。当然,当您访问站点链接时,它会显示 public_html 中的所有内容
更新 1:
进行全新安装后。这一切都在默认情况下工作。并逐个添加文件,我发现它与routes.php有关。改变
$route['default_controller'] = 'welcome';
到
$route['default_controller'] = 'main/index';
这是main.php
<?php
class main extends CI_Controller
{
public function __construct()
{
parent::__construct();
$this->load->model('home_model');
}
public function index($page = 'home')
{
$menu['menu'] = $this->home_model->get_menu();
$data['servers_table'] = $this->servers_table($this->home_model->get_servers());
$this->load->view('templates/header', $menu);
$this->load->view('pages/'.$page, $data);
$this->load->view('templates/footer');
}
}
【问题讨论】:
-
确保您已将 index.php 上传到根目录,即与“系统”目录存在的同一目录中
-
现在可以了吗?
-
@Deano 我正在上传全新安装的 CI 进行测试
-
全新安装工作。
标签: php .htaccess codeigniter