这要了我的命
我有什么?CI 版本:2.1.4 模块化扩展-wiredesignz 的 HMVC 是一个基本的 codeigniter(hmvc) 项目,它在本地服务器 (mamp) 中使用 php 5.5.3 的设置可以正常工作
我将项目移动到公共网络服务器后的问题我更改了以下内容。——application/config/config.php
$config['base_url'] = ' http://example.com/ ';
——application/config/database.php
$db['default']['hostname'] = 'localhost';
$db['default']['username'] = 'newdbusername';
$db['default']['password'] = 'newdbpassword';
$db['default']['database'] = 'newdbname';
——public_html/.htaccess
RewriteEngine On
RewriteBase /
#Removes access to the system folder by users.
#Additionally this will allow you to create a System.php controller,
#previously this would not have been possible.
#'system' can be replaced if you have renamed your system folder.
RewriteCond %{REQUEST_URI} ^system.*
RewriteRule ^(.*)$ /index.php?/$1 [L]
#When your application folder isn't in the system folder
#This snippet prevents user access to the application folder
#Submitted by: Fabdrol
#Rename 'application' to your applications folder name.
RewriteCond %{REQUEST_URI} ^application.*
RewriteRule ^(.*)$ /index.php?/$1 [L]
#Checks to
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ index.php?/$1 [L]
# If we don't have mod_rewrite installed, all 404's
# can be sent to index.php, and everything works as normal.
# Submitted by: ElliotHaughin
ErrorDocument 404 /index.php
因为我的索引页面将是“home”模块的索引功能,所以我没有触及 application/config 文件夹中的 routes.php 文件。以下是 routes.php 的设置
$route['default_controller'] = "home";
$route['404_override'] = '';
每当尝试访问http://example.com/时,我都会收到以下消息
404 Page Not Found 找不到您请求的页面。
如果我尝试 example.com/home,我会收到相同的消息,但 example.com/welcome 仍然欢迎来到 codeigniter 页面
到底是怎么回事!!!???为什么我不能从模块访问我的任何页面?我错过了什么?还有人遇到这个问题吗??
ps:如果有帮助,我的 cpanel 有 php 5.3.27
更新:: 下面是我的默认控制器的索引函数
<?php if ( ! defined('BASEPATH')) exit('No direct script access allowed');
class Home extends MX_Controller
{
function __construct() {
parent::__construct();
}
function index()
{
$this->load->library('recaptcha');
$data['recaptcha_html'] = $this->recaptcha->recaptcha_get_html();
$data['view_file'] = "checkmember";
$this->load->module('templates');
$this->templates->checkinfo();
}
=============
更新 2
<?php if ( ! defined('BASEPATH')) exit('No direct script access allowed');
class Welcome extends CI_Controller {
/**
* Index Page for this controller.
*
* Maps to the following URL
* http://example.com/index.php/welcome
* - or -
* http://example.com/index.php/welcome/index
* - or -
* Since this controller is set as the default controller in
* config/routes.php, it's displayed at http://example.com/
*
* So any other public methods not prefixed with an underscore will
* map to /index.php/welcome/<method_name>
* @see http://codeigniter.com/user_guide/general/urls.html
*/
public function index()
{
$this->load->view('welcome_message');
}
}
/* End of file welcome.php */
/* Location: ./application/controllers/welcome.php */