title: CodeIgniter, Requested page was not found
body: <p>I'm developing a web application in CodeIgniter, having a problem with the '404 page not found error'. Currently I have a login page, on which both the submit button and the link to the registration page are displaying the error. I've posted the code from the login page, controller and .htaccess below. For the login form, the error occurs always, regardless of whether the correct or incorrect login details are used.</p>
  
  <p>Controller:</p>
  
  <pre><code>&lt;?php
      class Main extends CI_Controller {
  
          public function __construct() { 
                  parent::__construct();
                  $this-&gt;load-&gt;model('system');
                  $this-&gt;load-&gt;helper('url_helper');
              }
  
          public function index() {
              $this-&gt;login();
          }
  
          public function login() {
              $this-&gt;load-&gt;helper('form');
              $this-&gt;load-&gt;library('form_validation');
  
              $data['title'] = "Login";
  
              $this-&gt;form_validation-&gt;set_rules('','','');
              $this-&gt;form_validation-&gt;set_rules('','','');
  
              if($this-&gt;form_validation-&gt;run() === FALSE) {
                  $this-&gt;load-&gt;view('login', $data);
              } else {
                  $this-&gt;authenticateuser();
              }
          }
  
          public function authenticateuser() {
              $username = $this-&gt;input-&gt;post('idNumber');
              $password = md5($this-&gt;input-&gt;post('passWd'));
  
              $query = $this-&gt;db-&gt;query("select * from users where idNumber='".$username."' and passWd='$password'");
              $row = $query-&gt;num_rows();
  
              if($row) {
                  $this-&gt;session-&gt;set_userdata(array('username' =&gt; $username));
                  $sessionID = $this-&gt;session-&gt;userdata('username');
                  $data['title'] = 'Dashboard';
  
                  $this-&gt;load-&gt;view('dashboard', $data);
              } else {
                  $data['error'] = 'Invalid Login Details';
                  $data['title'] = 'Login';
  
                  $this-&gt;load-&gt;view('login', $data);
              }
          }
  
          public function logout() {
              $this-&gt;session-&gt;unset_userdata('username');
              redirect('login');
          }
  
          // handles register page
          public function register() {
              $this-&gt;load-&gt;view('register');
  
              if($this-&gt;input-&gt;post('register')) {
                  $username=$this-&gt;input-&gt;post('userid');
                  $password=md5($this-&gt;input-&gt;post('pass'));
  
                  $this-&gt;System-&gt;registeruser($username, $password);
                  echo "User Registration Complete";
              }
          }
      }
  ?&gt;
  </code></pre>
  
  <p>Login:</p>
  
  <pre><code>&lt;html&gt;
      &lt;head&gt;
          &lt;title&gt;Login form&lt;/title&gt;
      &lt;/head&gt;
  
      &lt;body&gt;
          &lt;?php
              echo form_open('Main/authenticateuser');
              echo validation_errors();
  
              echo "&lt;p&gt;Username: ";
              echo form_input('username', $this-&gt;input-&gt;post('username'));
              echo "&lt;/p&gt;";
  
              echo "&lt;p&gt;Password: ";
              echo form_password('password');
              echo "&lt;/p&gt;";
  
              echo form_submit('login', 'Login');
              echo form_close();
  
          ?&gt;
  
          &lt;p&gt;&lt;a href="regsiter"&gt;Register&lt;/a&gt;&lt;/p&gt;
      &lt;/body&gt;
  &lt;/html&gt;
  </code></pre>
  
  <p>.htaccess:</p>
  
  <pre><code>Options +FollowSymlinks -Indexes
  RewriteEngine on
  
  DirectoryIndex index.php
  RewriteCond $1 !^(index\.php|resources|robots\.txt)
  RewriteCond %{REQUEST_FILENAME} !-f
  RewriteCond %{REQUEST_FILENAME} !-d
  RewriteRule ^(.*)$ index.php/$1 [L,QSA]
  </code></pre>