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:
- In config.php of config folder, use:
$config['enable_query_strings'] = FALSE;
- Use
$config['uri_protocol'] = 'AUTO';
Use $config['index_page'] = '';
- Also remember to set your base url. Mine is:
$config['base_url'] = 'http://localhost/code';
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