May 30, 2012

IIS 7 - redirecting HTTP to HTTPS

1. Creating certificate - Server Certificates
2. In site options add Bindings HTTPS 443
3. SSL Settings Require SSL
4. Create Redirect.htm in C:\Inetpub

<script type="text/javascript">
function redirectToHttps()
{
var httpURL = window.location.hostname+window.location.pathname;
var httpsURL = "https://" + httpURL ;
window.location = httpsURL ;
}
redirectToHttps();
</script>

5. In server options edit Error Pages add 403.4 and enter path to Redirect.htm
6. Then edit page - Edit Feature Settings. Values Custom error pages and path C:\Inetpub\Redirect.htm

No comments:

Post a Comment