Author Topic: How to Switch Http to Https?  (Read 265 times)

JennyRose

  • Beginner
  • *
  • Posts: 1
  • A beginner
    • Lajerrio
How to Switch Http to Https?
« on: August 30, 2017, 11:43:49 am »
Hi everyone. Https is a must for every website nowadays.  i have a website http://www.lajerrio.com, For secure and better for Google. how to switch my site's http to https?
Life has taught us that love does not consist in gazing at each other, but in looking outward together in the same direction.

jenkinhill

  • UK Web Developer & Consultant
  • Global Moderator
  • Super Hero
  • *
  • Posts: 26362
  • Always on vacation
    • Jenkin Hill Internet
Re: How to Switch Http to Https?
« Reply #1 on: August 30, 2017, 12:14:11 pm »
Not really a VirtueMart question, as this should apply to every type of website.

I see that you already have an SSL certificate in place on your server, to install that is normally the first step.
Access your site using https:// and look at the generated code, checking for all occurences of http: links. Where they exist steps should be taken to ensure that https: is used instead, or browsers will issue warnings about mixed/insecure content.
Once that is fixed it is easy to force the site to use SSL. I do this through appropriate .htaccess code, rather than by the settings in Joomla and VM. I also prefer not to use the www. prefix, so if present in a request for the site this is removed.

The .htaccess code I use is:

# match any URL with www and rewrite it to https without the www
RewriteCond %{HTTP_HOST} ^(www\.)(.*) [NC]
RewriteRule (.*) https://%2%{REQUEST_URI} [L,R=301]

# match urls that are non https (without the www)
RewriteCond %{HTTPS} off
RewriteCond %{HTTP_HOST} !^(www\.)(.*) [NC]
RewriteRule (.*) https://%{HTTP_HOST}%{REQUEST_URI} [L,R=301]

Kelvyn

Jenkin Hill Internet,
Keswick, Lake District

Unsolicited PMs/emails will be ignored.

Please mention your VirtueMart, Joomla and PHP versions when asking a question in this forum

Currently using VM3.2.4 on Joomla 3.8.2 PHP 7.0.23

Testing VM3.2.5 on J!3.8.2

AH

  • Global Moderator
  • Sr. Member
  • *
  • Posts: 2627
  • VirtueMart Version: 3.2.5
Re: How to Switch Http to Https?
« Reply #2 on: August 30, 2017, 13:44:24 pm »
Totally agree with Jenkin

Do it in htaccess and ignore using joomla settigns

Here is what I am using

Rewrites everything to https
Then removes the www. - if present
Quote

#force https
RewriteCond %{SERVER_PORT} 80
RewriteRule ^(.*)$ https://%{HTTP_HOST}%{REQUEST_URI} [L,R=301]

## remove www from urls
    RewriteCond %{HTTPS}s on(s)|
    RewriteCond %{HTTP_HOST} ^www\.(.+)$ [NC]
    RewriteRule ^ http%2://%1%{REQUEST_URI} [R=301,L]
regards
A

Joomla 3.8.2
php 5.6 + php 7