2013-04-24 106 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>