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

[讨论/交流] 去掉index.php的问题。

[复制链接]
发表于 2007-11-25 21:21:41 | 显示全部楼层 |阅读模式
我的目录是这样的http://127.0.0.1/test/
在test\sys\application\controllers\下有一个文件abcd,里面有一个类abcd
怎么不用通过这种方法http://[url=http://127.0.0.1/test/]http://127.0.0.1/test/index.php/abcd[/url]来访问,而是通过[url=http://127.0.0.1/test/abcd]http://127.0.0.1/test/abcd[/url]来访问?
按前面的贴子在test目录下加了个.htaccess,里面内容:RewriteEngine on
RewriteCond $1 !^(index\.php|images|robots\.txt)
RewriteRule ^(.*)$ /index.php/$1 [L]
可是好象不起作用。
访问[url=http://127.0.0.1/test/abcd][url=http://127.0.0.1/test/abcd]http://127.0.0.1/test/abcd[/url]提示找不到网页[/url]
如何可以去掉index.php?
发表于 2007-11-26 09:13:30 | 显示全部楼层
检查一下apache 的rewrite_module 有没有启用,然后再试试
发表于 2007-11-26 10:15:03 | 显示全部楼层
.htaccess 内容写的不对。
你不是在 /test/下吗? RewriteRule ^(.*)$ /index.php/$1 [L]  这个不能写成 /index.php/$1 吧?写成 /test/index.php/$1 试试!
 楼主| 发表于 2007-11-26 13:58:49 | 显示全部楼层
原来错误多多,一是apache的LoadModule rewrite_module modules/mod_rewrite.so没有打开,二是httpd.conf中<Directory />
    Options FollowSymLinks
    AllowOverride All
</Directory>
AllowOverride要改成All(我的默认好象是None)
三是/index.php/$1要改成/test/index.php/$1。
谢谢各位回答。
发表于 2007-12-15 10:28:22 | 显示全部楼层
楼主访问url的时候怎么把根目录写上了。。而且也没写端口。。这样能访问吗?

还有.htaccess的文件应该放在工程根目录下吧。。。文件名是不是任意的?
发表于 2007-12-16 23:54:24 | 显示全部楼层
不用写端口吧?
发表于 2011-11-21 15:13:35 | 显示全部楼层
为什么只有默认加载的首页中没有index.php。其它页面中还是有呢?请问是哪里的问题?是我遗漏了什么吗?
发表于 2011-11-22 22:49:29 | 显示全部楼层
config.php的base_url检查一下
发表于 2011-11-23 14:57:23 | 显示全部楼层
端口可以不用写的

本版积分规则