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

去掉index.php,为什么还有一个index?

[复制链接]
发表于 2014-2-18 23:18:32 | 显示全部楼层 |阅读模式
刚开始默认的url是http://localhost:8080/CI/ci/index.php/index
然后去掉了红色部分,后面蓝色部分无论怎样都去不掉,是什么?怎么去除?
后来伪静态静态后,还一直保留
http://localhost:8080/CI/ci/index/about_us.html
http://localhost:8080/CI/ci/index/contact.html


怎么办?已经折腾一晚上了

发表于 2014-2-19 11:02:38 | 显示全部楼层
那个是控制器吧……
发表于 2014-2-19 11:36:06 | 显示全部楼层
使用rewrite去掉的确实是index.php
使   http://localhost:8080/CI/ci/index.php/index/about_us.html
变成http://localhost:8080/CI/ci/index/about_us.html
后面这个index是控制器
如果想去掉的话 建议你看看“URI 路由”的设置
这个在手册的http://codeigniter.org.cn/user_guide/general/routing.html
按着规则配置下试试
 楼主| 发表于 2014-2-19 19:12:52 | 显示全部楼层
kissgxd 发表于 2014-2-19 11:36
使用rewrite去掉的确实是index.php
使   http://localhost:8080/CI/ci/index.php/index/about_us.html
变成 ...

不是控制器。

新建about us页面,代码如下:
PHP复制代码
 
<div    id="menu"><div    id="menumain">
<ul>
<li><?php echo anchor("index","Home");?></li>
<li><?php echo anchor("index/about_us","About us");?></li>
<li><?php echo anchor("index/contact","Contact");?></li>
</ul>
</div></div>
 
复制代码


这个蓝色字体就是这里面的index,我试过了,如果去掉,url里面就可以去掉index,但是改后就报404。
发表于 2014-2-19 23:59:55 | 显示全部楼层
目录 或者是 控制器

本版积分规则