我正在尝试让CakePHP 2.0在我家的Win2k笔记本电脑上运行,但是因为mod重写问题而受到了阻碍。对于以前版本的Cake(1.2,1.3),我使用了以下规则的ISAPI_rewrite(我的应用程序位于虚拟文件夹'cake'):
RewriteEngine on
RewriteBase /cake
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ index.php?url=$1 [QSA,L]
然而,这似乎不适用于CakePHP 2.0。如果我进入基本目录'localhost / cake /',我会得到标准的Cake欢迎屏幕(tmp目录状态等等),并说明所有内容都配置正确。如果我输入'localhost / cake / widgets / index',它会稍微搅拌一下,然后回到标准屏幕,说明一切正常。没错,纳达。
这不是我第一次遇到IIS问题,但我已经坚持使用这台笔记本电脑一段时间了。任何帮助将不胜感激。
答案 0 :(得分:1)
我已在这里回答: http://groups.google.com/group/cake-php/browse_thread/thread/c266c5227b16dab7
应该是:
index.php?/$1
答案 1 :(得分:0)
这对我有用:
<?xml version="1.0" encoding="UTF-8"?>
<configuration>
<system.webServer>
<rewrite>
<rules>
<rule name="Redirect plugin resources" stopProcessing="true">
<match url="^(.*)/(ico|img|css|files|js)(.*)$" />
<action type="Rewrite" url="app/plugin/{R:1}/webroot/{R:2}{R:3}" appendQueryString="false" />
</rule>
<rule name="Redirect static resources" stopProcessing="true">
<match url="^(ico|img|css|files|js)(.*)$" />
<action type="Rewrite" url="app/webroot/{R:1}{R:2}" appendQueryString="false" />
</rule>
</rules>
</rewrite>
</system.webServer>
</configuration>