title: PHP CodeIgniter - How to set default page for website root
body: <p>I am new to CodeIgniter, building website with 2 nested controller directories <code>backend</code> and <code>frontend</code>. All my pages are working fine except root. I am facing difficulty to set a default page when there is not path specified in url (only the website root). </p>
  
  <p>I want to render home page if there is no path after website root. I put <code>$route['default_controller'] = 'frontend/pages'</code>, but its not working. </p>
  
  <p>My <code>config/routes.php</code> is as follows:</p>
  
  <pre><code>$route['default_controller'] = 'frontend/pages';
  
  $route['user'] = 'user/index';
  $route['user/register']['GET'] = 'frontend/user/index';
  
  $route['user/register']['POST'] = 'frontend/user/register_user';
  $route['user'] = 'frontend/user/login_view';
  $route['user/login'] = 'frontend/user/login_view';
  $route['user/login_user'] = 'frontend/user/login_user';
  $route['user/user_profile'] = 'frontend/user/user_profile';
  $route['user/user_logout'] = 'frontend/user/user_logout';
  
  $route['admin'] = 'backend/Admin_area/dashboard';
  $route['admin/(index|dashboard)'] = 'backend/Admin_area/dashboard';
  $route['admin/(:any)/(:any)/(:any)'] = 'backend/$1/$2/$3';
  $route['admin/(:any)/(:any)'] = 'backend/$1/$2';
  $route['admin/(:any)'] = 'backend/$1';
  
  $route['/^$'] = 'frontend/pages/view/home';
  $route['(:any)'] = 'frontend/pages/view/$1';
  </code></pre>
  
  <p>When I visit <code>root/</code> is show me <code>404 error page</code>.</p>
  
  <p><code>Pages</code> Controller code:</p>
  
  <pre><code>&lt;?php
  class Pages extends Frontend_Controller {
  
      function __construct()
      {
          parent::__construct();
      }
  
      public function index()
      {
          $page = 'home';
              $this-&gt;data['pagetitle'] = ucfirst($page); 
  
              $this-&gt;render('pages/'. $page);
      }
  
          public function view($page = 'home')
      {
  
              $this-&gt;data['pagetitle'] = ucfirst($page); 
  
              $this-&gt;render('pages/'. $page);
      }
  }
  </code></pre>