Link to home
Start Free TrialLog in
Avatar of rcleon
rcleonFlag for United States of America

asked on

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+...)
        nUrl=mUrl.replace(re,"https:");
        location.href=nUrl;
      }
//-->
</SCRIPT>

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

Thanks

Rafael
ASKER CERTIFIED SOLUTION
Avatar of den_tsopa
den_tsopa

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial