title: Why does my URL redirect not work?
body: <p>I download CodeIgniter 2.1.0 and I followed the <a href="http://codeigniter.com/user_guide/tutorial/index.html" rel="nofollow">tutorial</a> on CodeIgniter 2.1.0.</p>
  
  <p>The problem is when I try to submit a form in this URL:</p>
  
  <pre><code>http://localhost/CodeIgniter/index.php/news/create
  </code></pre>
  
  <p>the page is redirected to this URL:</p>
  
  <pre><code>http://localhost/CodeIgniter/index.php/news/localhost/CodeIgniter/index.php/news/create
  </code></pre>
  
  <p>I tired many ways to change the route.php but it doesn't work. How can I fix this??</p>
  
  <p><strong>route.php</strong></p>
  
  <pre><code>$route['news/create'] = 'news/create';
  $route['news/(:any)'] = 'news/view/$1';
  $route['news'] = 'news';
  $route['(:any)'] = 'pages/view/$1';
  $route['default_controller'] = 'pages/view';
  </code></pre>
  
  <p>This is the code for the form page:</p>
  
  <pre><code>public function create()
  {
      $this-&gt;load-&gt;helper('form');
      $this-&gt;load-&gt;library('form_validation');
  
      $data['title'] = 'Create a news item';
  
      $this-&gt;form_validation-&gt;set_rules('title', 'Title', 'required');
      $this-&gt;form_validation-&gt;set_rules('text', 'text', 'required');
  
      if ($this-&gt;form_validation-&gt;run() === FALSE)
      {
          $this-&gt;load-&gt;view('templates/header', $data);   
          $this-&gt;load-&gt;view('news/create');
          $this-&gt;load-&gt;view('templates/footer');
  
      }
      else
      {
          $this-&gt;news_model-&gt;set_news();
          $this-&gt;load-&gt;view('news/success');
      }
  }
  </code></pre>
  
  <p>I notice that when the form page when the page is loaded, below code segment will executed, however, the else segment never got changes to execute.</p>
  
  <pre><code>if ($this-&gt;form_validation-&gt;run() === FALSE)
      {
          $this-&gt;load-&gt;view('templates/header', $data);   
          $this-&gt;load-&gt;view('news/create');
          $this-&gt;load-&gt;view('templates/footer');
  
      }
  </code></pre>
  
  <p>This is the form page, nothing special, just call the create function shown above.
  <strong>create.php</strong></p>
  
  <pre><code>&lt;h2&gt;Create a news item&lt;/h2&gt;
  
  &lt;?php echo validation_errors(); ?&gt;
  
  &lt;?php echo form_open('news/create') ?&gt;
  
  &lt;label for="title"&gt;Title&lt;/label&gt; 
  &lt;input type="input" name="title" /&gt;&lt;br /&gt;
  
  &lt;label for="text"&gt;Text&lt;/label&gt;
  &lt;textarea name="text"&gt;&lt;/textarea&gt;&lt;br /&gt;
  
  &lt;input type="submit" name="submit" value="Create news item" /&gt; 
  
  &lt;/form&gt;
  </code></pre>
  
  <p>This is the HTML for the form page:</p>
  
  <pre><code>&lt;html&gt;
  &lt;head&gt;
  &lt;title&gt;Create a news item - CodeIgniter 2 Tutorial&lt;/title&gt;
  &lt;/head&gt;
  &lt;body&gt;
  &lt;h1&gt;CodeIgniter 2 tutorial&lt;/h1&gt;&lt;h2&gt;Create a news item&lt;/h2&gt;
  
  &lt;form action="localhost/CodeIgniter/index.php/news/create" method="post" accept-charset="utf-8"&gt;
  &lt;label for="title"&gt;Title&lt;/label&gt; 
  &lt;input type="input" name="title" /&gt;&lt;br /&gt;
  
  &lt;label for="text"&gt;Text&lt;/label&gt;
  &lt;textarea name="text"&gt;&lt;/textarea&gt;&lt;br /&gt;
  
  &lt;input type="submit" name="submit" value="Create news item" /&gt; 
  
  &lt;/form&gt;&lt;strong&gt;&amp;copy;2012&lt;/strong&gt;
  &lt;/body&gt;
  &lt;/html&gt;
  </code></pre>
  
  <p>And when I press the <code>create new item</code> button, the URL changed to</p>
  
  <pre><code>http://localhost/CodeIgniter/index.php/news/localhost/CodeIgniter/index.php/news/create
  </code></pre>
  
  <p>and page shows <code>404 Pages Not Found</code></p>