views:

64

answers:

1

I'm running an .net framework 4 web application project on my local IIS 7.5 with installed URL Rewrite 2.0 module.

My application contains a page called sitemap.aspx. I want to be able to map /sitemap/ to the sitemap.aspx

This is my code so far and it does not work. Upon calling /sitemap I'll get a 404 Not Found error screen. What is missing?

   <rewrite>
        <rules>
            <rule name="LowerCaseRule1" enabled="true" stopProcessing="true">
                <match url="[A-Z]" ignoreCase="false" />
                <conditions>
                    <add input="{URL}" matchType="Pattern" pattern="^.+\.((axd)|(js)|(xaml))$" ignoreCase="true" negate="true" />
                </conditions>
                <action type="Redirect" url="{ToLower:{URL}}" redirectType="Permanent" />

            </rule>
            <rule name="RemoveTrailingSlashRule1" stopProcessing="true" enabled="true">
                <match url="(.*)/$" />
                <conditions>
                    <add input="{REQUEST_FILENAME}" matchType="IsDirectory" negate="true" />
                    <add input="{REQUEST_FILENAME}" matchType="IsFile" negate="true" />
                </conditions>
                <action type="Redirect" url="{R:1}" />
            </rule>
        </rules>
        <rewriteMaps>
            <rewriteMap name="test">
                <add key="/sitemap" value="sitemap.aspx"/>
            </rewriteMap>
        </rewriteMaps>
    </rewrite>
A: 

I was missing an entry in the section:

Add

        <rule name="Rewrite rule1 for test">
            <match url=".*" />
            <conditions>
                <add input="{test:{REQUEST_URI}}" pattern="(.+)" />
            </conditions>
            <action type="Rewrite" url="{C:1}" appendQueryString="false" />
        </rule>

and everything works fine

citronas