3

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.

Kirk Beard
  • 9,569
  • 12
  • 43
  • 47
abhishek
  • 47
  • 6

1 Answers1

2

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';

user470714
  • 2,858
  • 1
  • 28
  • 34
Abdulla Nilam
  • 36,589
  • 17
  • 64
  • 85