Redirect HTTP to HTTPS

Method1: Using http Redirect feature:

To know more see earliar section.

Method2: Using custom error page:


First bind website with https. To binding website see earliar section,s step3.


Enable SSL on this website. to do this ->

Go to IIS-Expand server name-sites- select “site name” – in feature view select “SSL setting- select ” require SSL”-Apply.


Create a web page Using HTML & Java script codes as given below.





<script language=”JavaScript”>

function redirectHttpToHttps()


var httpURL= window.location.hostname + window.location.pathname +;

var httpsURL= “https://&#8221; + httpURL;

window.location = httpsURL;







save it as “c:\intpub\”HttpRedirect.htm”.


IIS – sites – site name – (feature view)error pages-add-status code 403.4 & browse HTTP redirect.htm-ok


IIS-sites-site name-(feature view)error pages-select 403.4- edit feature setting-select custom error page & browse httpredirect.htm & path type file or redirect-OK.

Method 3: Using custom web.config  file:


Enable SSL on this website.


Download Url Rewrite Module and install it.


You have to add a script in “c:\intpub\wwwroot\web.config” file  under <configuration> section which is given below.



<rule name=”https redirect”>

url=”(.*)” ignoreCase=”false” />


<add input=”{HTTPS}” pattern=”off” ignoreCase=”false” />


<action type=”Redirect” redirectType=”Found” url=”https://{HTTP_HOST}{REQUEST_URI}”/>




save the web.config file.


Restart IIS. Test Url Redirection will work fine.


One response to “Redirect HTTP to HTTPS

Leave a Reply

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

You are commenting using your 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 )

Google+ photo

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

Connecting to %s