title: getting a 404 error while clicking on a article
body: <p>I am building my first CodeIgniter website and I am conquering a problem that seems to be hard to solve.. </p>
  
  <p>When I click on a article to read it I keep getting a 404 page. ( not found ) </p>
  
  <p>the link that I get is as follows</p>
  
  <p>index.php/articles/articlename</p>
  
  <p>In my controller I have the following for the view part</p>
  
  <pre><code>    public function view($slug) {
      $data['article_item'] = $this-&gt;articles_model-&gt;get_article($slug);
  
      if (empty($data['article_item']))
      {
          show_404();
      }
  
      $data['title'] = $data['article_item']['title'];
  
      $this-&gt;load-&gt;view('templates/header', $data);
      $this-&gt;load-&gt;view('articles/view', $data);
      $this-&gt;load-&gt;view('templates/side', $data);
      $this-&gt;load-&gt;view('templates/footer');
  }
  </code></pre>
  
  <p>As you see it has to include the view.php in the articles directory</p>
  
  <p>In my router I have the following</p>
  
  <pre><code>    $route['articles/(:any)'] = 'articles/view/$1';
  $route['articles/create'] = 'articles/create';
  $route['(:any)'] = 'pages/view/$1';
  $route['gallery'] = 'gallery';
  $route['articles'] = 'articles';
  $route['default_controller'] = 'home';
  $route['404_override'] = '';
  </code></pre>
  
  <p>Just to be sure I have posted every relevant stuff here is the link that I create</p>
  
  <pre><code>&lt;a href="articles/&lt;?php echo $article_item['slug'] ?&gt;" class="button"&gt;Read more&lt;/a&gt;
  </code></pre>
  
  <p>and the model</p>
  
  <pre><code>    &lt;?php
  class Articles_model extends CI_Model {
  
      public function __construct() {
          $this-&gt;load-&gt;database();
      }
  
      public function get_article($slug = FALSE) {
          if ($slug === FALSE) {
              $query = $this-&gt;db-&gt;get('articles');
              return $query-&gt;result_array();
          }
  
          $query = $this-&gt;db-&gt;get_where('articles', array('slug' =&gt; $slug));
          return $query-&gt;row_array();
      }
  }
  </code></pre>
  
  <p>I hope someone can tell me what I'm doing wrong here..</p>