用2个参数重写的IIS Express Url不起作用

时间:2013-10-04 09:45:23

标签: web-config iis-express iis-8

我只想说:

<?xml version="1.0" encoding="utf-8"?>
<configuration>
  <system.webServer>
    <rewrite>
        <rules>
            <rule name="index/page/method to index.php?page=page&method=method">
                <match url="^index/([^/]+)/([^/]+)$" />
                <action type="Rewrite" url="index.php?page={R:1}&method={R:2}" />
            </rule>
            <rule name="index/page to index.php?page=page">
                <match url="^index/([^/]+)$" />
                <action type="Rewrite" url="index.php?page={R:1}" />
            </rule>
            <rule name="index to index.php">
                <match url="^index" />
                <action type="Rewrite" url="index.php" />
            </rule>
        </rules>
     </rewrite>
   </system.webServer>
</configuration>

当我调用localhost时,我得到以下内容: HTTP-Fehler 500.19 - 内部服务器错误

我的问题是第一条规则不起作用:( 当我删除第一条规则时规则正常工作...... 有人能帮助我吗?

自己编辑: IIS不喜欢&amp; ...所以我将其更改为&amp;并且工作正常^^

1 个答案:

答案 0 :(得分:2)

很明显,你应该使用&amp;,正如微软在其文章中所说的那样,

http://www.iis.net/learn/extensions/url-rewrite-module/creating-rewrite-rules-for-the-url-rewrite-module