http to https redirect Windows 2008 IIS

This is the best way I have found to redirect http to https and to a specific sub url.

Hence if the user types mail.uwhpwatertown.com, which implies http, they will, thru IIS error handling, get redirected to https://mail.whatever.com/owa

I was doing this for a client, and I took some screenshots to make it easier to understand.

It’s a good solution for OWA and probably for other websites as well.

Step ONE:

change the error setting.

Go to the Default Web Site in IIS managment, click the error pages button

On the far right, click the “Edit Features Settings…”

Change the settings from the bottom radio button….

iiserror

That gives you this error ……

To this setting

Which gives you this setting

Step two:

Click on this 403 error (403 means you hit the web page with http, when it requires https)

Change it from this:

To this

image007

Click ok, now it should look like this:

image008

Test it by typing mail.whatever.com, or localhost (at the server), you will get redirected to https://mail.whatever.com/owa

So, in summary, that covers http to https redirect (with additional redirect to /owa)

But what about if someone types https://mail.whatever.com , meaning they typed https, but did NOT include the /owa at the end.

We need that to redirect to the /owa subfolder.

In the root of the web server, add a file called default.htm and add the following text at the contents of that default.htm

Change the FQDN to your appropriate address.

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">

<HTML dir=ltr>
<HEAD>
  <!--
  	Do Not Change anything in the <HEAD> section except the data in the
  	"META http-refresh" tag or you may render this page non-functional
  -->
  <TITLE>The page cannot be displayed</TITLE>
  <META content=NOINDEX name=ROBOTS>
  <META http-equiv=Content-Type content="text-html; charset=Windows-1252">
  <!--
  	Using the following META-tag, we instruct the browser to automatically seek another page.
  	http-equiv="Refresh" instructs the browser to refresh its content
  	content= has two parts:
  		0 = time delay in seconds before the browser actually executes the redirection
  	 	URL = the actual content to seek
  	With the given settings, the browser will seek "URL" immediately
  -->
  <META http-equiv="Refresh" content="0;URL=https://FQDN/owa">
  <META content="MSHTML 5.50.4522.1800" name=GENERATOR>
</HEAD>
<BODY>
</HTML>


Advertisements

About Mike

owner of blog
This entry was posted in Exchange 2010. Bookmark the permalink.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

w

Connecting to %s