nbabn 发表于 2007-11-25 21:21:41

去掉index.php的问题。

我的目录是这样的http://127.0.0.1/test/
在test\sys\application\controllers\下有一个文件abcd,里面有一个类abcd
怎么不用通过这种方法http://http://127.0.0.1/test/index.php/abcd来访问,而是通过http://127.0.0.1/test/abcd来访问?
按前面的贴子在test目录下加了个.htaccess,里面内容:RewriteEngine on
RewriteCond $1 !^(index\.php|images|robots\.txt)
RewriteRule ^(.*)$ /index.php/$1
可是好象不起作用。
访问http://127.0.0.1/test/abcd提示找不到网页
如何可以去掉index.php?

jgcao 发表于 2007-11-26 09:13:30

检查一下apache 的rewrite_module 有没有启用,然后再试试

Hex 发表于 2007-11-26 10:15:03

.htaccess 内容写的不对。
你不是在 /test/下吗? RewriteRule ^(.*)$ /index.php/$1 这个不能写成 /index.php/$1 吧?写成 /test/index.php/$1 试试!

nbabn 发表于 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。
谢谢各位回答。

sam 发表于 2007-12-15 10:28:22

楼主访问url的时候怎么把根目录写上了。。而且也没写端口。。这样能访问吗?

还有.htaccess的文件应该放在工程根目录下吧。。。文件名是不是任意的?:o

Hex 发表于 2007-12-16 23:54:24

不用写端口吧?

deppr 发表于 2011-11-21 15:13:35

为什么只有默认加载的首页中没有index.php。其它页面中还是有呢?请问是哪里的问题?是我遗漏了什么吗?

acabin 发表于 2011-11-22 22:49:29

config.php的base_url检查一下

caedy 发表于 2011-11-23 14:57:23

端口可以不用写的
页: [1]
查看完整版本: 去掉index.php的问题。