codeigniter url handling to remove index.php and method name(codeigniter url 处理以删除 index.php 和方法名称)
问题描述
我第一次使用 codeigniter,我必须管理我的 URL 才能在没有 index.php/controller 的情况下查看 URL,所以我如何编写 ht 访问权限以及将它保存在我的文件夹结构以及我必须进行的任何其他更改的位置在我的自动加载或配置文件中做....
我的网址如下...
<块引用>
project_name/index.php/controller_name/method_name/param 1/param 2
那么对于这个网址,我该如何编写 ht 访问规则?请需要帮助......
打开 config.php 并进行如下替换
$config['index_page'] = "index.php"
到
$config['index_page'] = ""
直接替换
$config['uri_protocol'] ="AUTO"
到
$config['uri_protocol'] = "REQUEST_URI"
在 HTACCESS 文件中输入以下代码
RewriteEngine onRewriteCond $1 !^(index.php|resources|robots.txt)RewriteCond %{REQUEST_FILENAME} !-fRewriteCond %{REQUEST_FILENAME} !-d重写规则 ^(.*)$ 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 和方法名称的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持编程学习网!
本文标题为:codeigniter url 处理以删除 index.php 和方法名称


基础教程推荐
- phpmyadmin 错误“#1062 - 密钥 1 的重复条目‘1’" 2022-01-01
- HTTP 与 FTP 上传 2021-01-01
- 使用 PDO 转义列名 2021-01-01
- 找不到类“AppHttpControllersDB",我也无法使用新模型 2022-01-01
- 在 yii2 中迁移时出现异常“找不到驱动程序" 2022-01-01
- PHP 守护进程/worker 环境 2022-01-01
- 如何在 XAMPP 上启用 mysqli? 2021-01-01
- Doctrine 2 - 在多对多关系中记录更改 2022-01-01
- 在 CakePHP 2.0 中使用 Html Helper 时未定义的变量 2021-01-01
- 如何在 Symfony 和 Doctrine 中实现多对多和一对多? 2022-01-01