• 1 Vote(s) - 3 Average
  • 1
  • 2
  • 3
  • 4
  • 5
'default_controller' in codeingter3 HMVC is not working

#1
Hi, In my project, I am using CI3 HMVC. Now, I am facing problem with routing. I want users to type www.demosite.com and that take them or call my home module. I do not want to show like www.demosite.com/home. I want to show the url like www.demosite.com. for this, I set default controller in application/config/routes, like this

Code:
$route['default_controller'] = "home";

also in my home module, I added a route folder where I wrote

Code:
$route['home'] = "home";

here is my .htaccess

Code:
AddType text/x-component .htc
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteCond $1 !(index\.php|assets/)
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ index.php/$1 [L]

</IfModule>

and here is my home controller

Code:
class Home extends MX_Controller{
  function __construct(){
    parent::__construct();

  }

  function index($stub=""){
    $baseUrl=base_url();
    $this->load->helper("url");

      echo $this->_showHomepage();     

  }
}

When I run this, I got 404 error. Please help me to solve this problem.
Reply


Digg   Delicious   Reddit   Facebook   Twitter   StumbleUpon  


  Theme © 2014 iAndrew  
Powered By MyBB, © 2002-2020 MyBB Group.