IIS URL Rewrite rule - Default document for subdirectories

Posted by Antonio Bakula on Stack Overflow See other posts from Stack Overflow or by Antonio Bakula
Published on 2010-06-15T08:11:19Z Indexed on 2010/06/15 8:32 UTC
Read the original article Hit count: 276

Filed under:
|
|

I would like create URL rewrite rule that will set default document for my virtual folders. eg. someting like this

www.domain.com/en/ -> www.domain.com/en/index.aspx
www.domain.com/hr/ -> www.domain.com/hr/index.aspx
www.domain.com/de/ -> www.domain.com/de/index.aspx

directories en, hr, de doesn't really exists on web server they are just markers for languange used in site used by home grown http module that will rewrite path with query params.

Quick solution was define rule for every single lang, something like this :

<rewrite>
    <rewriteMaps>
        <rewriteMap name="Langs">
            <add key="/en" value="/en/index.aspx" />
            <add key="/hr" value="/hr/index.aspx" />
            <add key="/de" value="/de/index.aspx" />
        </rewriteMap>
    </rewriteMaps>
<rules>

But I would really like solution that would not require changes in web.config and adding rewrite rule for every languange used on particular site.

Thanks !

© Stack Overflow or respective owner

Related posts about ASP.NET

Related posts about iis7