Shubham Jha
Shubham Jha

Reputation: 37

SSL Encryption Issue

I have hosted an ecommerce website with the OpenCart script at www.medicosales.in

I am facing some errors.

  1. The website when opened by typing medicosales.in is NOT automatically resolving to https:// where I have seen in SSL secured sites that just by typing yourdomain.com the URL automatically takes https://

  2. It's showing this message message

How to solve it?

Upvotes: 0

Views: 36

Answers (2)

Daniel Waghorn
Daniel Waghorn

Reputation: 2985

  1. You should set up your .htaccess file if you're using Apache, or similar if you're using another webserver to rewrite your URLs to include https:// if they do not already. This will force the user's browser to access via the correct protocol.

For Apache place the following code into the top of your .htaccess file in your document root for the site ensuring mod_rewrite is enabled.

RewriteEngine On
RewriteCond %{HTTPS} !=on
RewriteRule ^ https://%{HTTP_HOST}%{REQUEST_URI} [L,R=301]
  1. Whenever you load a resource externally e.g. via something like <img src="http://example.com/myimage.jpg" ... you must ensure that the protocol is HTTPS also otherwise your browser will give you that message since the resource was not loaded securely.

The way to fix this is ensure that all externally linked resources have their URLs prefixed with // and not http://. This way the browser will use the current protocol to fetch the resource.

Thanks @davidgiga1993 for pointing out // rather than using https://

Upvotes: 2

Amit
Amit

Reputation: 1885

It is not automatic. You need to send a 302/301 redirect back to the user pointing to the https URL.

Upvotes: 0

Related Questions