Redirect to SSL with JavaScript

window.location = "https://" + window.location.hostname + window.location.pathname +;
You might wanna test if window.location.href doesn't start with "https" before doing that, so you don't redirect unless you have to.

Be the first to comment

You can use [html][/html], [css][/css], [php][/php] and more to embed the code. Urls are automatically hyperlinked. Line breaks and paragraphs are automatically generated.