icewating 发表于 2011-8-23 15:50:07

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

请问如何去掉URL中的index.php,还有增加html后缀啊。http://localhost/my_blog/index.php/product/shoes/123 如果不输入index.php.就无法选择控制器。请问用什么办法去掉index.php。还有,如何在末尾加上.html。我按照指南上修改过,但总是不成功。求解,谢谢。我用的是CI2.02

Rooting 发表于 2011-9-27 17:48:50

.htcaccess

长城的草 发表于 2011-10-14 08:34:04

Rooting 发表于 2011-9-27 17:48 static/image/common/back.gif
.htcaccess

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

anjesky 发表于 2011-10-27 21:23:39

正确 {:soso_e182:}

幽蓝冰魄 发表于 2011-10-28 10:12:42

.htcaccess 或者 rewrite 去除 index.php,那个 html 我是用后缀实现的,就是做 url 的时候有点小麻烦。

thenbsp 发表于 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'] = '';

dreamans 发表于 2012-2-7 00:20:18

.htaccess
RewriteEngine on
RewriteBase /my_blog/
RewriteRule ^(.*)\.html$ index.php/$1
页: [1] 2
查看完整版本: 请问如何去掉URL中的index.php,增加html后缀啊