title: How to set dynamic route to use slug in CodeIgniter?
body: <p>Let's say that I have a controller named </p>
  
  <p><strong>pages</strong></p>
  
  <p>and there is a method </p>
  
  <p><strong>slug_on_the_fly</strong></p>
  
  <p><code>public function slug_on_the_fly($slug)</code></p>
  
  <p>How would my route for this look like?</p>
  
  <p>E.g. for blog controller it would be easy:</p>
  
  <pre><code>$route['blog/(:any)'] = 'pages/slug_on_the_fly/$1';
  </code></pre>
  
  <p>and then <code>http://localhost/blog/name-of-the-article</code> works nice</p>
  
  <p>However, what if I want to do it like without <code>blog</code> so e.g.</p>
  
  <p><code>http://localhost/name-of-the-article</code> or <code>http://localhost/another-article-blablabla</code></p>
  
  <p>How to do it and don't break another routes e.g. <code>$route['friends'] = 'users';</code> or <code>$route['about-us'] = 'pages/about_us';</code> ?</p>
  
  <p>Because if I do:
  <code>$route['(:any)'] = 'pages/slug_on_the_fly/$1';</code></p>
  
  <p>It will probably ruin everything else or?</p>