3

I have a URL rewrite set up on a site where users can create their own sites on a subdomain.

<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>

As an example, a user could create a page http://client.basedomain.com/about-us and this will successfully pass "client" and "about-us" to my application.

What I need to be able to do is override this behavior in the case of a specific page name following their domain.

So if the page http://client.basedomain.com/restricted was accessed, it would not perform the above rewrite, and instead rewrite it to the url "render_page_restricted.aspx?site={C:1}

Any help is GREATLY appreciated.

MooreFish
  • 81
  • 1
  • 7
  • If it solved your problem, you should post your solution as an answer and accept it rather than editing your question :) – cheesemacfly Apr 25 '13 at 15:49
  • Yeah, I see you did that, but then you should mark your own answer as the accepted answer as well. That should be possible, at least after two days or something, but I see that's been passed with quite some margin now... – Bart Jun 25 '13 at 12:16

1 Answers1

5

In standard fashion, after spending a few days working on it, then finally posting it on SE, I cracked it 20 min later. Sigh. In the event someone else has the same problem, here's my fix:

<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>
MooreFish
  • 81
  • 1
  • 7