title: CodeIgniter routing: Passing parameter before controller and catching it on the default_controller
body: <p>I'm using a site wide parameter that controls the layout of the website. This parameter goes before anything else in the URL and is followed by the usual <em>controller/parameters</em> sections.</p>
  
  <pre><code>mywebsite/{section}/controller/parameter1/parameter2
  </code></pre>
  
  <p>I could define routes like the one bellow for each controller, but would like to avoid it as the <em>section</em> parameter is only relevant to the layout and not to the controllers.</p>
  
  <pre><code>$route['(:any)/controller/(:any)/(:any)'] = 'controller/$2/$3/$1';
  </code></pre>
  
  <p>Instead I would to be able to make the default_controller catch the first segment and store it as a view variable or session / cookie, so that the rest of the controllers can simply ignore it.</p>
  
  <pre><code>$route['(:any)/controller/(:any)/(:any)'] = 'controller/$2/$3';
  </code></pre>