【问题标题】:Codeigniter Dreamhost with subdomain带有子域的 Codeigniter Dreamhost
【发布时间】:2011-08-29 22:35:32
【问题描述】:

我在 CodeIgniter 中有一个应用程序,并将其上传到子域 Dreamhost 引发以下错误:

遇到错误 无法加载请求的文件:sitio/inicio/index.php

我的应用程序配置如下:

config.php

$config['base_url'] = 'http://sub.domain.com/';
$config['index_page'] ='';
$config['uri_protocol'] = 'AUTO';
$config['url_suffix'] =''; 

routes.php

$route['default_controller'] = "sitio/inicio"; 

.htaccess

RewriteEngine on
RewriteBase /home/myuser/sub.domain.com/
RewriteCond $1! ^(index\.php|public/img|public/css|public/js|public/uploads|robots\.txt)
RewriteRule ^(.*)$ index.php/$1 [L] 

inicio.php

class Inicio extends CI_Controller{

    function __construct(){
        parent::__construct();
    }

    function index(){
        $this->load->view('sitio/inicio/index');
    }
}

我的默认控制器位于控制器内的子文件夹中,我的视图也在视图内的子文件夹中。问题是什么?我尝试了论坛中的一些解决方案,但问题仍然存在。

谢谢。

【问题讨论】:

  • 我们能看看你的控制器叫什么名字吗?你能告诉我们控制器扩展...部分吗?
  • 有我的控制器...谢谢你的帮助。
  • 在检查 CI 设置之前,您必须首先调试您的 Apache 环境。暂时删除/重命名您的 .htacces 文件。你可以访问 index.php 吗?创建一个只执行 echo "hi"; 的兄弟 index2.php。可以访问吗?
  • 我重命名了 .htaccess 文件,但我遇到了同样的错误...我无法访问文件 index.php。然后,我创建另一个文件 index2.php,打印一个 Hi!我可以看到它,它工作得很好。
  • 在你调用“$this->load->view('sitio/inicio/index')”的那一行,是你的视图文件“application/views/sitio/inicio/”的路径索引.php”?我的猜测是你想在views文件夹中调用index.php,你只需要使用“$this->load->view('index')”

标签: php codeigniter dreamhost


【解决方案1】:

您将默认路由指向控制器 sitio 和函数 inicio。如果你想将默认路由指向 inicio 删除 sitio

$route['default_controller'] = "sitio/inicio";

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 2013-02-16
    • 1970-01-01
    • 1970-01-01
    • 2014-03-08
    • 2012-04-03
    • 2014-02-18
    • 1970-01-01
    • 2013-04-07
    相关资源
    最近更新 更多