先说下我的问题
我的域名配置在web下
www.test.com是可以直接访问到主页的
我一直www.test.com/gii报界面错误
只有www.test.com/index.php/gii才能访问到gii界面
但gii界面上所有的链接都是以www.test.com/gii/crud这样的形式访问
不会在域名后面自己补充index.php,所以一点还会报界面未找到错误
这是问题,问题清楚后接下来就是解决了
我的解决方法是加个rewrite重写模块,解决url问题
在web目录下添加.htaccess文件
Options +FollowSymLinks
IndexIgnore */*
RewriteEngine on
# if a directory or a file exists, use it directly
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
# otherwise forward it to index.php
RewriteRule . index.php
就解决了上述问题
要注意的是我这里用的是Apache的rewrite
需要修改配置文件
简单说下,就两步
1、修改Apache的配置文件,去掉#
#LoadModule rewrite_module modules/mod_rewrite.so
2、vhosts.conf下
把“
AllowOverride None
”改成“
AllowOverride All