3

我在用户可以在子域上创建自己的网站的站点上设置了 URL 重写。

<rule name="CName to URL - Rewrite" stopProcessing="true">
    <match url=".*" />
    <conditions>
        <add input="{HTTP_HOST}" pattern="^(?!www)(.*)\.basedomain\.com" />
    </conditions>
<action type="Rewrite" url="render_page.aspx?site={C:1}&amp;page={R:0}" />
</rule>

例如,用户可以创建一个页面http://client.basedomain.com/about-us,这将成功地将“client”和“about-us”传递给我的应用程序。

我需要做的是在特定页面名称跟随其域的情况下覆盖此行为。

所以如果页面http://client.basedomain.com/restricted被访问了,就不会进行上面的重写,而是重写到url "render_page_restricted.aspx?site={C:1}

任何帮助是极大的赞赏。

4

1 回答 1

5

以标准方式,花了几天时间研究它,最后将它发布到 SE 上,我在 20 分钟后破解了它。叹。如果其他人有同样的问题,这是我的解决方法:

<rule name="Restricted Page Name Override - Rewrite" stopProcessing="true">
    <match url="^(?!www)(.*)restricted" />
    <conditions>
        <add input="{HTTP_HOST}" pattern="^(?!www)(.*)\.basedomain\.com"/>
    </conditions>
    <action type="Rewrite" url="render_page_restricted.asp?site={C:1}" />
</rule>
于 2013-04-26T12:08:42.533 回答