我正在将PHP应用程序从Apache移动到IIS服务器。我试图翻译以下.htaccess规则:
RewriteEngine On
RewriteRule ^(.*)$ public/$1?%{QUERY_STRING} [QSA,L]
它只是将所有请求(以及查询字符串)重定向到公共子目录。
我在web.config文件中尝试过类似的内容 -
<?xml version="1.0" encoding="UTF-8"?>
<configuration>
<system.webServer>
<rewrite>
<rules>
<rule name="Root Hit Redirect" stopProcessing="true">
<match url="^$" />
<action type="Redirect" url="/public/index.php" />
</rule>
</rules>
</rewrite>
</system.webServer>
</configuration>
但它一直陷入重定向循环。在这种情况下,什么应该是正确的web.config规则?
答案 0 :(得分:0)
通过在IIS中导入规则来管理解决此问题。
http://akrabat.com/winphp-challenge/zend-framework-url-rewriting-in-iis7/