douwei2825 2013-06-18 21:05
浏览 45
已采纳

codeigniter autoload默认控制器,无法加载视图

I have controller home with function index which loads view index under home directory

class Home extends CI_Controller {      
    public function index()
    {
        $this->load->view('home/index');
    }
}

I've changed default controller call inside routes.php to home instead of welcome.

Now, when navigate to mysite.com I've got error message

Unable to load the requested file: `home/index.php`

But when I type inside address mysite.com/home everything loads.

What can be a problem?

Thanks

Update: .htaccess is

RewriteEngine on
RewriteCond %{SCRIPT_FILENAME} !-d
RewriteCond %{SCRIPT_FILENAME} !-f
RewriteCond $1 !^(index\.php|css|Images|Content|Scripts|robots\.txt)
RewriteRule ^(.*)$ ./index.php/$1 [L]
  • 写回答

1条回答 默认 最新

  • drjmrg8766 2013-06-20 09:25
    关注

    You need to update your config/config.php as

       $config['index_page'] = '';
    
    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论

报告相同问题?

悬赏问题

  • ¥15 请看一下,学校实验要求,我需要具体代码
  • ¥50 pc微信3.6.0.18不能登陆 有偿解决问题
  • ¥20 MATLAB绘制两隐函数曲面的交线
  • ¥15 求TYPCE母转母转接头24PIN线路板图
  • ¥100 国外网络搭建,有偿交流
  • ¥15 高价求中通快递查询接口
  • ¥15 解决一个加好友限制问题 或者有好的方案
  • ¥15 急matlab编程仿真二阶震荡系统
  • ¥20 TEC-9的数据通路实验
  • ¥15 ue5 .3之前好好的现在只要是激活关卡就会崩溃