[Okta Webinar] Learn how to a build a cloud-first strategyRegister Now

x
?
Solved

chancing hhtp to hhtps

Posted on 2006-04-13
1
Medium Priority
?
154 Views
Last Modified: 2008-02-26
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
0
Comment
Question by:rcleon
1 Comment
 
LVL 2

Accepted Solution

by:
den_tsopa earned 2000 total points
ID: 16450401
This script redirects HTTP GET request to HTTPS. It is ok.
There is only one string I want to fix:
     var re = /^http\:/i;
0

Featured Post

Concerto Cloud for Software Providers & ISVs

Can Concerto Cloud Services help you focus on evolving your application offerings, while delivering the best cloud experience to your customers? From DevOps to revenue models and customer support, the answer is yes!

Learn how Concerto can help you.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Introduction HTML checkboxes provide the perfect way for a web developer to receive client input when the client's options might be none, one or many.  But the PHP code for processing the checkboxes can be confusing at first.  What if a checkbox is…
In Part 1 (http://www.experts-exchange.com/Programming/Languages/Scripting/JavaScript/A_7849-Hex-Maze.html) we covered the hexagonal maze basics -- how the cells are represented in a JavaScript array and how the maze is displayed.  In this part, we'…
The viewer will learn the basics of jQuery, including how to invoke it on a web page. Reference your jQuery libraries: (CODE) Include your new external js/jQuery file: (CODE) Write your first lines of code to setup your site for jQuery.: (CODE)
The viewer will learn the basics of jQuery including how to code hide show and toggles. Reference your jQuery libraries: (CODE) Include your new external js/jQuery file: (CODE) Write your first lines of code to setup your site for jQuery…
Suggested Courses

872 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question