去掉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? 检查一下apache 的rewrite_module 有没有启用,然后再试试 .htaccess 内容写的不对。
你不是在 /test/下吗? RewriteRule ^(.*)$ /index.php/$1 这个不能写成 /index.php/$1 吧?写成 /test/index.php/$1 试试! 原来错误多多,一是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。
谢谢各位回答。 楼主访问url的时候怎么把根目录写上了。。而且也没写端口。。这样能访问吗?
还有.htaccess的文件应该放在工程根目录下吧。。。文件名是不是任意的?:o 不用写端口吧? 为什么只有默认加载的首页中没有index.php。其它页面中还是有呢?请问是哪里的问题?是我遗漏了什么吗? config.php的base_url检查一下 端口可以不用写的
页:
[1]