You*_*mon 8 php mod-rewrite codeigniter clean-urls
我有以下网址..
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)
Cat*_*ish 10
您可以为每个网址设置路线:
在config/routes.php文件中,只需像这样设置每个页面:
$route['ci/home'] = "ci/site_controller/home";
Run Code Online (Sandbox Code Playgroud)
归档时间: |
|
查看次数: |
18787 次 |
最近记录: |