hi我第一次使用codeigniter,我必须管理我的URL才能在没有index.php/controller的情况下查看URL,所以我如何编写ht访问权限,在哪里保存我的文件夹结构,以及我必须在自动加载或配置文件中做的任何其他更改。。。。
my URL is like below...
项目名称/index.php/controller_name/meethod_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"
在HTACCESS文件中放入以下代码
RewriteEngine on
RewriteCond $1 !^(index'.php|resources|robots'.txt)
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ index.php/$1 [L,QSA]
将此代码放入.htaccess文件中。
RewriteEngine on
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule .* index.php/$0 [PT,L]