I have a web page that is routed with https and all works well. I noticed I could change it to http and the page still loaded.
I am trying to check the window url and make it https if it was entered as http. Only for this page and with Jquery or Javascript. ( I know most would recommend not using a script for security )
This isn't working for me:
<script>
var url = window.location.pathname;
if url.match('^http://')
{
url = url.replace(/^http:\/\//, 'https://');
window.location.pathname = url;
}
Thank you