mylifeinaminute.com

HTTPS redirects and IIS

by liquidpooled on Jun.09, 2008, under Microsoft, Office, Sharepoint Server, Windows SharePoint Services

Not quite SharePoint specific, but sometimes necessary is the ability to redirect a http connection (port 80) to a https connection (port 443) for an entire site. While there are several ways to do this, one way that works for both SharePoint and IIS 6.0 in general is the following (*Note this is for SharePoint):

  1. Create a new html file in your 12 hive (this way your virtual directory for IIS is already created by the SharePoint instance).
    • httpsredirect.htm
  2. Place your file in the 12 Hive (C:\Program Files\Common Files\Microsoft Shared\web server extensions\12\TEMPLATE\LAYOUTS\httpsredirect.htm)
  3. Enter the following in the html file created in step 1:
    
    <html>
    <head>
    <title>HTTPS Redirector</title>
    <SCRIPT type="text/javascript">
    <!--
    if (location.protocol != 'https:')
    {
    window.location = 'https://'+ location.host + location.pathname + location.search;
    }
    // -->
    </SCRIPT>
    </head>
    <body>
    </body>
    </html>
    
  4. Define your custom error page in IIS for 404.3 errors for each SharePoint site which you want to be SSL only.
    • Select the 404.3 error in the properties dialog for the website.
    • Browse to the custom file you created (C:\Program Files\Common Files\Microsoft Shared\web server extensions\12\TEMPLATE\LAYOUTS\httpsredirect.htm)
    • Make sure that you are leaving the type as “File”
  5. Browse your site as http and you will be redirected to the SSL site.
No comments for this entry yet...

Leave a Reply

Looking for something?

Use the form below to search the site:

Still not finding what you're looking for? Drop a comment on a post or contact us so we can take care of it!

Visit our friends!

A few highly recommended friends...