News:

Support the VirtueMart project and become a member

Main Menu

How to Switch Http to Https?

Started by JennyRose, August 30, 2017, 11:43:49 AM

Previous topic - Next topic

JennyRose

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

#1
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
Lowestoft, Suffolk, UK

Retired from forum life November 2023

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

AH

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 4.4.5
php 8.1