joelmdev joelmdev - 1 year ago 51
ASP.NET (C#) Question

Use IIS7 URL Rewriting to redirect all requests

I have a .NET site that I am taking down and I plan on redirecting all requests to '' using a rewrite rule in the web.config. Should be a simple task, but it's not. I've removed all the content from the filesystem except a single Default.aspx page and a default web.config with the following rewrite rule:

<rule name="Redirect All" stopProcessing="true">
<match url="^(www\.)?mysite\.com(/.+)$" />
<action type="Redirect" url="" appendQueryString="false" />

If I request the server is still trying to look up garbage.aspx, or any other url I provide just as if the rewrite rule was not there.
Very frustrating. Ideas?

Answer Source

Do you want to redirect ALL requests to your new site? If so, this should do it:

<match url=".*" />