Redirect to SSL/HTTPS with JavaScript

This snippet is a life saver if nothing else is working, and you absolutely must redirect a site to SSL.

<script>
if(location.protocol != 'https:'){
	location.href = 'https:' + window.location.href.substring(window.location.protocol.length);
}
</script>