asp.netregexurl-rewritingurlrewriting.net

UrlRewriting.Net Regular expression - "Not in string"


i may be barking up the wrong tree here but i'm banging my head against a wall trying to write a regex rewrite.

i have two site that are identical but by choice the client uses one server (call it http://www1.test.com) to host part of the site to take load off the other.

i am using urlrewriting.net and so far have setup the easy side (www.test.com/minisite) to point at www1.test.com/minisite.

the issue i now have is i want a rule or set of rules that will point everything that is not on www1.test.com/minisite (ie www1.test.com/default.aspx) to point back to www.test.com/$1

so what i really need is a reg ex that will look for anything in the url that does NOT include /minisite AND /assets

is this even possible? and if so what will the regex rule look like?

thanks in advance cheers Doug


Solution

  • I'm not familiar with URLRewriter, but I think this should work for you:

    look for:

    ^~(?!/(?:minisite|assets))(.*)$
    

    Replace with:

    ~$1
    

    That will match anything but URLs starting with /minisite or /assets