Redirects in IIS – ASP.NET

While I am comfortable with working in Apache mod_redirect, Redirects on Windows IIS are a totally different animal. On a client’s project, I needed to implement a redirect on a Windows IIS server, using the DotNetNuke platform.

Here is how I did it

1. Look for the file named “SiteUrls.config” in the main root directory of the hosting environment.

2. Edit that file as follows:

<RewriterRule>
 <LookFor>.*PageThatNeedsToBeRedirected.aspx(.*)</LookFor>
 <SendTo>https://example.com/DestinationPage.php</SendTo>
 </RewriterRule>

3. Save the file and reload in the browser to verify that the redirect is occurring correctly.

This is it. You will need to replace “PageThatNeedsToBeRedirected” with the actual file name of the old path/file. Similarly, “DestinationPage” will be replaced by the page being redirected to.

 


Posted

in

by

Tags:

Comments

Leave a Reply

Your email address will not be published. Required fields are marked *