Routes not working codeigniter Routes not working codeigniter codeigniter codeigniter

Routes not working codeigniter


If you put index.php after domain this will work.

http://www.example.com/index.php/login/

You should remove index.php from url by replacing in config and .htaccess

replace in config.php

$config['index_page'] = 'index.php';

by

$config['index_page'] = '';

.htaccess

RewriteEngine OnRewriteCond %{REQUEST_FILENAME} !-fRewriteCond %{REQUEST_FILENAME} !-dRewriteRule ^(.*)$ index.php/$0 [L]


This is what worked for me:

  1. In config.php of config folder, use: $config['enable_query_strings'] = FALSE;
  2. Use $config['uri_protocol'] = 'AUTO';
  3. Use $config['index_page'] = '';
  4. Also remember to set your base url. Mine is: $config['base_url'] = 'http://localhost/code';
  5. Finally use the following htaccess file:

    <IfModule mod_rewrite.c>RewriteEngine OnRewriteCond %{REQUEST_FILENAME} !-fRewriteCond %{REQUEST_FILENAME} !-dRewriteRule ^(.*)$ /code/index.php/$1 [L]</IfModule>

NB: Remember to edit your path to index.php in the htaccess file. Hope this works for you