IIS 7 Redirect

Today, we ran into an issue when upgrading our Windows Server 2003 to Windows Server 2008. As you made already know, with Windows Server 2008, it has a new IIS version then in Windows Server 2003.

– Windows Server 2003 runs IIS version 6

– Windows Server 2008 runs IIS version 7

How to redirect in IIS 7?

1. Create a HTML file – Copy and save the below code to a text file. Name it like “httpRedirect.htm

* Tips: Save the file (httpRedirect.htm) to the directory where your website is located.

Here’s an example:

<!DOCTYPE HTML PUBLIC “-//W3C//DTD HTML 4.0 Transitional//EN”>
<title>Cloudmedy IIS 7 Redirect Example</title>
<meta http-equiv=”REFRESH” content=”0;url=https://redirect.cloudmedy.com”></HEAD>
Click <a href=”https://redirect.cloudmedy.com”>here</a>, if automatic redirecting doesn’t work.

2. Change the IIS setting for the “403 error page” to point to the above file location

  • Launch the “Internet Information Services (IIS) Manager
  • On the left-hand side, find and highlight the website that you want to have the redirect setup
  • Make sure you are in “Features View”, click on the “Error Pages” icon
  • Click on the “Add…” link
  • For Status code, type in “403.4”
  • Choose the “Insert content from static file into the error response” option and browse to the file path where you saved the httpRedirect.htm file.

Note: If you are getting the below error, just type in “httpRedirect.htm” to the “File path” section. This is assuming that you saved the file inside the website directory.

HTTP Error 500.19 – Internal Server Error
Absolute physical path “xxxxx” is not allowed in system.webserver /httpErrors.
Use relative path instead

  • Back at the Error Pages, click on the “Edit Feature Settings…”
  • Select the “Custom Error Pages” option
  • Hit “Ok” and you are done
  • Last step, check the “Require SSL” option in the “SSL Settings” setting and click on “Apply” on the right-hand side.


– Open a browser and type in your website address with http only.

Example: https://www.cloudmedy.com

If the link redirects to https://xxxxxxx.xxx, then you have just created a custom redirect in IIS 7.

Note: If you ran into a “Lock Violation” error, make sure you have the redirect file inside your website directory.