tags:

views:

107

answers:

1
+1  Q: 

IIS URL Rewrite

Ok, this is driving me nuts... I'm trying to rewrite my urls like this:

Now:
http://www.somedomain.com/Somepage.aspx
http://www.somedomain.com/AnotherPage.aspx

Desired:
http://www.somedomain.com/somepage/
http://www.somedomain.com/anotherpage/

Can anyone help me out with this? The terms in the User Interface are damn confusing.

Thanks.

A: 

I found the answer:

<rewrite>
  <rules>
    <rule name="Redirect" stopProcessing="true">
      <match url="^([^\.]+)\.aspx$" />
      <conditions>
        <add input="{REQUEST_METHOD}" negate="true" pattern="^POST$" />
      </conditions>
      <action type="Redirect" url="{ToLower:{R:1}}/" appendQueryString="false" redirectType="Permanent" />
    </rule>
    <rule name="Rewrite" stopProcessing="true">
      <match url="^([^/]+)/$" />
      <conditions>
        <add input="{REQUEST_FILENAME}" matchType="IsFile" negate="true" />
        <add input="{REQUEST_FILENAME}" matchType="IsDirectory" negate="true" />
      </conditions>
      <action type="Rewrite" url="{R:1}.aspx" />
    </rule>
  </rules>
</rewrite>
RajenK