用户
 找回密码
 入住 CI 中国社区
搜索
查看: 7741|回复: 10
收起左侧

请问如何去掉URL中的index.php,增加html后缀啊

[复制链接]
发表于 2011-8-23 15:50:07 | 显示全部楼层 |阅读模式
20CI币
请问如何去掉URL中的index.php,还有增加html后缀啊。http://localhost/my_blog/index.php/product/shoes/123 如果不输入index.php.就无法选择控制器。请问用什么办法去掉index.php。还有,如何在末尾加上.html。我按照指南上修改过,但总是不成功。求解,谢谢。我用的是CI2.02

发表于 2011-9-27 17:48:50 | 显示全部楼层
.htcaccess
回复

使用道具 举报

发表于 2011-10-14 08:34:04 | 显示全部楼层
Rooting 发表于 2011-9-27 17:48
.htcaccess

我修改了.htcaccess 还是不能去掉index.php
RewriteEngine on
RewriteRule ^(.*)$ $1 [L]
回复

使用道具 举报

发表于 2011-10-27 21:23:39 | 显示全部楼层
正确 {:soso_e182:}
回复

使用道具 举报

发表于 2011-10-28 10:12:42 | 显示全部楼层
.htcaccess 或者 rewrite 去除 index.php,那个 html 我是用后缀实现的,就是做 url 的时候有点小麻烦。
回复

使用道具 举报

发表于 2012-1-9 22:34:57 | 显示全部楼层
本帖最后由 thenbsp 于 2012-1-9 22:38 编辑

手册上有啊,具体看我博客吧
详解:http://www.thenbsp.com/view-codeigniter-remove-index/


我博客也是 CI 开发的,刚上线。

回复

使用道具 举报

发表于 2012-1-15 17:24:55 | 显示全部楼层
http://codeigniter.org.cn/forums/thread-4-1-2.html
这里有答案,如何去掉index.php
但是加.html我不会
回复

使用道具 举报

发表于 2012-1-31 17:03:38 | 显示全部楼层
config.php
回复

使用道具 举报

发表于 2012-1-31 17:03:54 | 显示全部楼层
/*
|--------------------------------------------------------------------------
| URL suffix
|--------------------------------------------------------------------------
|
| This option allows you to add a suffix to all URLs generated by CodeIgniter.
| For more information please see the user guide:
|
| http://codeigniter.com/user_guide/general/urls.html
*/

$config['url_suffix'] = '';
回复

使用道具 举报

发表于 2012-2-7 00:20:18 | 显示全部楼层
.htaccess
RewriteEngine on
RewriteBase /my_blog/
RewriteRule ^(.*)\.html$ index.php/$1 [L]
回复

使用道具 举报

本版积分规则