chancing hhtp to hhtps

All my site is under a SSL certificate. some clients just type hhtp and not https so they get an erro.

I modify the following script. I just want to make sure the it is correct. or is there better way. I'm just learning.

<SCRIPT LANGUAGE="JavaScript1.2" TYPE="text/javascript">
      var re = /http\:/ig; //only if no https, not www.
      var mUrl=location.href;
      if (mUrl.indexOf("http:") >=0) { // remove http:// - requires JavaScript 1.2 (internet explorer 4+,netscape 4+ opera 4+...)

The guy that actualy created the original script is no longer with the company so I just can not ask.


Who is Participating?
This script redirects HTTP GET request to HTTPS. It is ok.
There is only one string I want to fix:
     var re = /^http\:/i;
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.