Yii在IIS下的伪静态处理是,在根目录建立httpd.ini文件,然后使用IIS的伪静态规则,写入自己需要的规则:

我购买的虚拟主机在香港,因为windows的主机比较多,于是我也中招了,于是四处寻求方法,四处尝试,终于找到了适合Yii的伪静态规则:

代码如下:

1
2
3
4
5
6
7
8
9
10
11
12
13
[ISAPI_Rewrite]
# 3600 = 1 hour
CacheClockRate 3600
RepeatLimit 32
RewriteEngine On
#伪静态规则
RewriteBase /
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)/(.*)$ $1/index.php?$2
RewriteRule !\.(js|ico|gif|jpe?g|bmp|png|css)$ index.php [L]
我在虚拟机上测试通过了,哈哈,希望对你也有用