title: Regex to exclude categories from url in Codeigniter. How?
body: <p>I would like to have</p>
  
  <p>these urls as categories on my page:</p>
  
  <pre><code>http://example.com/en/articles        //for list of all
  http://example.com/en/articles/cars    //for list of all cars articles
  http://example.com/en/articles/nature  //for list of all nature acrticles
  http://example.com/en/articles/sport    //for list of all sport articles
  </code></pre>
  
  <p>I am using i18n that is why I have also another links like:</p>
  
  <pre><code>http://example.com/fr/articles        //for list of all
  http://example.com/fr/articles/cars    //for list of all cars articles
  http://example.com/fr/articles/nature  //for list of all nature acrticles
  http://example.com/fr/articles/sport    //for list of all sport articles
  </code></pre>
  
  <p>This is easy, I call a controller articles.php anf inside it I have functions cars, nature, sport and everything works well.</p>
  
  <p>However, I want to have articles, no matter what category they are, like this:</p>
  
  <p><a href="http://example.com/en/articles/article-about-cars" rel="nofollow">http://example.com/en/articles/article-about-cars</a>
  http://example.com/en/articles/article-about-nature</p>
  
  <p>So, the category fell out from url when full article is view.</p>
  
  <p>I am using i18n so my routes for this look like this:</p>
  
  <pre><code>$route[’^en/articles/(.+)$’] = “articles/show_full_article/$1”;
  $route[’^fr/articles/(.+)$’] = “articles/show_full_article/$1”;
  </code></pre>
  
  <p>But this call everytime the function show_full_article, because it is in the 2nd segment.</p>
  
  <p>So, I somehow need to rebuild the regex in:</p>
  
  <p>$route[’^en/articles/(.+)$’] = “articles/show_full_article/$1”;</p>
  
  <p>to exclude functions cars, nature and sport. I have only 3 categories so typing it manually is no big deal.</p>
  
  <p>Please, if you know how to type the regex in routes.php to exclude these three categories , so codeigniter do not see them anymore as article names, let me know. I will appreciate it very much.</p>
  
  <p>Thank you in advance for any advice.</p>