CodeIgniter路由总是通过index.php?

Fra*_*oss 3 routing codeigniter

CodeIgniter初学者在这里.我网站的基本网址是' http:// localhost/routing / '.

// config.php
$config['base_url'] = 'http://localhost/routing/';
Run Code Online (Sandbox Code Playgroud)

我只是尝试使用以下规则将URL" http:// localhost/routing/admin " 路由到管理控制器,但它不起作用.相反,我必须使用' http://localhost/routing/index.php/admin '.

$route['default_controller'] = 'seasons';
$route['admin'] = 'admin';
$route['404_override'] = '';
Run Code Online (Sandbox Code Playgroud)

问题:有没有办法从网址中删除'index.php'?

Sli*_*eam 5

在.htaccess文件和config.php中进行更改

应用程序/ config.php文件

$config['index_page'] = '';
Run Code Online (Sandbox Code Playgroud)

的.htaccess

RewriteEngine On
RewriteBase /
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule .* index.php/$0 [PT,L]
Run Code Online (Sandbox Code Playgroud)