William Jiang

JavaScript,PHP,Node,Perl,LAMP Web Developer – http://williamjxj.com; https://github.com/williamjxj?tab=repositories

3 tips to redirect http to https

(1) to setup, either in webserver’s config files, such as httpd.conf, conf.d/domains_ssl.conf, or in $HOME/.htaccess. The following is set in $HOME/.htaccess which is convenient:

RewriteEngine On
RewriteCond %{HTTPS} off
RewriteRule (.*) https://%{HTTP_HOST}%{REQUEST_URI}

(2) In PHP scripts, if there are http links to download .js or .css, be sure to replace it from https or locally. Otherwise it won’t work in IE. e.g. from:

<script type="text/javascript" src="http://www.google.com/jsapi"></script>
<script type="text/javascript">
  google.load("jquery", "1.4.2");
</script>
<script language="javascript" type="text/javascript" src="http://bp.yahooapis.com/2.4.21/browserplus-min.js"></script>

To:

<script language="javascript" type="text/javascript" src="jquery-1.4.2.min.js"> /script>
<script language="javascript" type="text/javascript" src="browserplus-min.js"> /script>

To do so, try to download the js codes locally, then do the inclusion.

(3) Version compatiable.
The application uses jQuery 1.4.2 to do the developing, then use jQuery 1.5.1 to deploy. However, under the verion of 1.5.1, some .js plugins don’t work.
I had to change back to jQuery 1.4.2.

After the above modification, the app is now available by using https.

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: