URL Rewrite from /default.aspx to /

Welcome to Programming Tutorial official website. Today - we are going to cover how to solve / find the solution of this error URL Rewrite from /default.aspx to / on this date .

I’m using the URL Rewriting.NET tool with IIS 6. I’ve got my default page content set for default.aspx in IIS. What I’m trying to do is have /default.aspx provide a 301 redirect to the root directory (www.example.com/default.aspx -> www.example.com). I’ve tried turning off default documents, to no avail.

What I’m hoping to do is use a couple of URL Rewriting.NET rules to accomplish this goal. Any thoughts?


Sorry, I forgot to clarify. If I redirect from /default.aspx to / with default documents turned on (I’d like to leave them on) then I get an infinite loop of default -> / -> default


In the end I wound up using IIS 7 with the URL Rewrite module, which allows you to do this redirect properly.

Edit :

The rule is

<rule name="Default Redirect" stopProcessing="true">
    <match url="^default.aspx$" />
    <action type="Redirect" url="/" redirectType="Permanent" />

you can do that with a separate rule for each folder, or you can use

<rule name="All Redirect">
    <match url="^(.*/)*default.aspx$" />
    <action type="Rewrite" url="{R:1}" />