解决CodeIgniter伪静态失效
网络编程 2021-07-05 09:50www.168986.cn编程入门
今天在项目中希望将原来丑陋的地址变得漂亮简单;
原来地址:http://127.0.0.1/onsite/index.php/wele/index/abc123
修改后地址:http://127.0.0.1/onsite/abc123.html
代码如下:
<IfModule mod_rewrite.c>
RewriteEngine on
RewriteBase /onsite
RewriteCond %{REQUEST_URI} ^system.*
RewriteRule ^(.*)$ /index.php?/$1 [L]
RewriteCond %{REQUEST_URI} ^application.*
RewriteRule ^(.*)$ /index.php?/$1 [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)\.html$ index.php/wele/index/$1 [L]
</IfModule>
规则是没有错的,但万想不到CodeIgniter竟然报404找不到页面;经过测试在根目录建立同名的html文件是能够正常显示的;
那问题应该是CI的配置导致的;经过一番波折,发现一个参数:
代码如下:
$config['uri_protocol'] = 'AUTO';
把它改成:
代码如下:
$config['uri_protocol'] = 'PATH_INFO';
页面终于显示正常了;
编程语言
- 机械手焊接机器人编程 机械手焊接设备编程
- vb数据库编程实例,vb做数据库
- tiobe世界编程语言排行榜,全球编程语言排行
- 成都java编程培训 成都it编程培训中心
- 编程基础培训,编程基础知识培训
- flash游戏编程基础教程,flash游戏开发教程
- 不会英语能学编程吗 不会英语可以学程序员吗
- 爱心代码编程C语言 爱心代码编程c语言公式
- c语言编程学习入门 c语言编程快速入门
- 西门子plc编程培训 西门子plc编程培训班
- 哪里可以学编程 台州哪里可以学编程
- 少儿编程哪个好 少儿编程哪个品牌好
- 编程是什么意思,图形编程是什么意思
- c语言编程软件下载,c语言编程软件在哪下载
- java编程软件下载,java编程下载手机版
- ug编程培训学校,ug编程培训教程