views:

97

answers:

3

Previously, on StackOverflow ...

(Summarized)

I need to capture all requests, for a particluar subdomain .. and rewrite their destination.

Now, the trick to determining the host via regex was solved.

Now, i need to make sure all requests to the root index page is rewritten, but i can't figure out the correct regex to find the 'homepage' / website root.

this is what i have....

<if header="HTTP_HOST" match="^foo\.mydomain\.com\.au(?::\d+)?/?$">
    <!-- snip some other rewrites, eg./buying/product -> ~/Pages/Foo/Bar.aspx -->
    <rewrite url="^/$" to="~/Pages/SomeWeirdFolder/Home.aspx" processing="stop"/>
</if>

Now if one of the rewrites were not found, then it falls through and continues.

So .. can anyone please help?

UPDATE

I've also tried "^$", "^~/$", "^~?/?$" ... with no luck.

A: 

Does this work?

<rewrite url="^/?$" to="~/Pages/SomeWeirdFolder/Home.aspx" processing="stop"/>
<!-- -----------^ -->
Tomalak
nope. tried that also. (ie. optional root folder with start and end anchors). I'll update my original post with my other attempts...
Pure.Krome
A: 

Can you elaborate on what you are trying to match. If the text that you are matching only contains "/" then what you have should match (unless you need to escape /, like \/). However if what you are trying to replace is the leading "/", as in /foo/bar/ with ~/MyPath/foo/bar then we need to account for the characters after the first "/"

Jasmeet
I'm trying to match the root url which rewriter is trying to goto.
Pure.Krome
A: 

I found out the problem.

The root directory of the site is noit '/', is was the file the default document is being set to .. in this case '/default.aspx'

after that, it all worked :)

Pure.Krome