我有以下网址..
http://localhost/ci/site_controller/home
Run Code Online (Sandbox Code Playgroud)
我想从url中删除site_controller 控制器导致..
http://localhost/ci/home
Run Code Online (Sandbox Code Playgroud)
我怎么能在CodeIgniter中做到这一点?
注意:如果你因为我不知道如何使用mod_rewrite,你会问我尝试了什么,而不是我刚刚搜索谷歌.
编辑
我在我的routes.php中有这个
$route['default_controller'] = "site_controller/home";
$route['ci/home'] = 'ci/site_controller/home';
$route['404_override'] = '';
Run Code Online (Sandbox Code Playgroud)
但还是不行!
的.htaccess
RewriteEngine On
RewriteBase /ci/
RewriteCond %{REQUEST_URI} ^system.*
RewriteRule ^(.*)$ /index.php/$1 [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ index.php/$1 [L]
ErrorDocument 404 /index.php
Run Code Online (Sandbox Code Playgroud)