2013-04-24 108 views
3

我有一个URL重写设置在用户可以在子域上创建自己的网站的网站。IIS 7 URL重写 - 匹配子域名,但不包括特定的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,这将顺利通过“客户端”和“关于美”我的应用程序。

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

因此,如果http://client.basedomain.com/restricted的页面被访问,也不会执行上述改写,而是它改写到URL“render_page_restricted.aspx网站= {C:1}

任何帮助是极大的赞赏?

+0

如果它解决了你的问题,你应该发布你的解决方案作为回答,并接受它而不是编辑你的问题:) – cheesemacfly 2013-04-25 15:49:32

+0

是的,我看到你做到了,但你应该把自己的答案标记为接受的答案。这应该是可能的,至少在两天之后或者某事之后,但我看到现在已经有相当多的利润了。 – Bart 2013-06-25 12:16:14

回答

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>