I am confused when I try to route from localhost/admin to localhost/index.php/admin
localhost/index.php/admin - this link working fine.
I have tried:
$route['admin'] = 'index.php/admin';
$route['default_controller'] = 'front';
localhost/index.php/front is working fine when I open localhost it displays front page which is not working.
I am using CodeIgniter HMVC in this example.
I added extra code as it was not allowing me to post the question.
Because you need to remove index.php in your URL
Go to config/config.php
$config['base_url'] = 'http://localhost/projectname/';
$config['index_page'] = ''; # remove index.php on here
In .htaccess - place outside application folder.
RewriteEngine on
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
#RewriteRule .* index.php/$0 [PT,L]
RewriteRule ^(.*)$ index.php/$1 [L,QSA]
And in routes.php
remove this $route['admin'] = 'index.php/admin';
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With