codeigniter url处理来删除index.php和方法名 [英] codeigniter url handling to remove index.php and method name
问题描述
在我使用codeigniter第一次,我必须管理我的URL来查看URL没有index.php /控制器,所以我怎么能写ht访问,我保持我的文件夹结构以及任何其他更改我有在我的自动加载或配置文件....
我的URL如下...
project_name / index.php / controller_name / method_name / param 1 / param 2
所以对于这个URL我怎么写ht访问规则?
解决方案打开config.php并执行以下替换
$ config ['index_page'] =index.php
到
$ config ['index_page'] =
只需替换
$ config ['uri_protocol'] =AUTO
到
$ config ['uri_protocol'] =REQUEST_URI
AND在HTACCESS FILE中输入以下代码
RewriteEngine on
RewriteCond $ 1!^(index\.php | resources | robots\.txt)
RewriteCond%{REQUEST_FILENAME}!-f
RewriteCond%{REQUEST_FILENAME}!-d
RewriteRule ^(。*)$ index.php / $ 1 [L,QSA]
hi i am using codeigniter first time and i have to manage my URL to view URL without index.php/controller so how can i write ht access and where i keep it my folder structure as well as any other changes i have to do in my auto load or config file....
my URL is like below...
project_name/index.php/controller_name/method_name/param 1/param 2
so for this URL how can i write ht access rule?please need helpful......
解决方案 Open config.php and do following replaces
$config['index_page'] = "index.php"
to
$config['index_page'] = ""
Just replace
$config['uri_protocol'] ="AUTO"
to
$config['uri_protocol'] = "REQUEST_URI"
AND IN HTACCESS FILE put following code
RewriteEngine on
RewriteCond $1 !^(index\.php|resources|robots\.txt)
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ index.php/$1 [L,QSA]
这篇关于codeigniter url处理来删除index.php和方法名的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!