Welcome Guest, Not a member yet? Register   Sign In
'default_controller' in codeingter3 HMVC is not working
#1

(This post was last modified: 02-13-2020, 07:37 AM by surma.)

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


Messages In This Thread
'default_controller' in codeingter3 HMVC is not working - by surma - 02-13-2020, 07:36 AM



Theme © iAndrew 2016 - Forum software by © MyBB