Author Topic: Items fail to add to cart in https ssl  (Read 5723 times)

jenkinhill

  • UK Web Developer & Consultant
  • Global Moderator
  • Super Hero
  • *
  • Posts: 26993
  • Always on vacation
    • Jenkin Hill Internet
Re: Items fail to add to cart in https ssl
« Reply #15 on: May 26, 2017, 13:13:08 pm »
I don't make any config settings in Joomla/VirtueMart, I just use .htaccess to force all pages to SSL - I also drop the www. for all sites now.

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

Unsolicited PMs/emails will be ignored.

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

Currently using VM 3.4.0.9935 on Joomla 3.8.12 PHP 7.0.31
Testing VM 3.4.0.9941 on Joomla 3.8.12

rage76

  • Jr. Member
  • **
  • Posts: 143
Re: Items fail to add to cart in https ssl
« Reply #16 on: May 26, 2017, 17:54:08 pm »
Thanks GJC & Jenkinhill

This is what I am using in my .htaccess

RewriteEngine on
RewriteCond %{HTTP_HOST} ^mysite.com [NC]
RewriteRule ^(.*)$ https://www.mysite.com/$1 [L,R=301,NC]

When I disable SSL in virtuemart, it leads to http page, so some modification is required. Please help me with it.

Also I would like to know any benefits of dropping the "www"?

best wishes

AH

  • Global Moderator
  • Sr. Member
  • *
  • Posts: 2802
  • VirtueMart Version: 3.4
Re: Items fail to add to cart in https ssl
« Reply #17 on: May 27, 2017, 12:17:01 pm »
Many sites  dont use www any more,  it is often seen as outdated

and it helps in your marketing if you drop it

www.yoursitename.com

vs

yoursitename.com


regards
A

Joomla 3.8.13
php 7.1

jenkinhill

  • UK Web Developer & Consultant
  • Global Moderator
  • Super Hero
  • *
  • Posts: 26993
  • Always on vacation
    • Jenkin Hill Internet
Re: Items fail to add to cart in https ssl
« Reply #18 on: May 27, 2017, 12:49:46 pm »
In the good old days (1900s) www. was just a domain protocol, just like ftp. telnet. or mail.  Some servers actually required the use of www. as a subdomain for a website.But that is history. There is no need at all for the www. now, and for people typing in a web address it is 4 extra keys to push. Of course there are still people who type http:// in front of the domain as well.................
Kelvyn

Jenkin Hill Internet,
Lowestoft, Suffolk, UK

Unsolicited PMs/emails will be ignored.

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

Currently using VM 3.4.0.9935 on Joomla 3.8.12 PHP 7.0.31
Testing VM 3.4.0.9941 on Joomla 3.8.12

rage76

  • Jr. Member
  • **
  • Posts: 143
Re: Items fail to add to cart in https ssl
« Reply #19 on: May 27, 2017, 18:21:24 pm »
When I disable "Enable SSL for sensitive areas" in virtuemart, it leads to http page, so some modification is required.

Please guide me to resolve this issue.

AH

  • Global Moderator
  • Sr. Member
  • *
  • Posts: 2802
  • VirtueMart Version: 3.4
Re: Items fail to add to cart in https ssl
« Reply #20 on: May 28, 2017, 11:13:32 am »
Just set the .htaccess as Jenkin has shown you

It should be SSL everywhere thereafter.

At least set this to force https everywhere

Code: [Select]

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

Joomla 3.8.13
php 7.1

rage76

  • Jr. Member
  • **
  • Posts: 143
Re: Items fail to add to cart in https ssl
« Reply #21 on: May 28, 2017, 16:39:15 pm »
Dear AH

Thank you for the input. Your suggestion seems to be working !!

Hope it wont cause any untoward issue.

Warm regards

AH

  • Global Moderator
  • Sr. Member
  • *
  • Posts: 2802
  • VirtueMart Version: 3.4
Re: Items fail to add to cart in https ssl
« Reply #22 on: May 28, 2017, 18:48:31 pm »
Thanks for the update

You should be fine - as long as you don't hard code urls in your site with HTTP:// as you will get a mixed content message in the browser
regards
A

Joomla 3.8.13
php 7.1

rage76

  • Jr. Member
  • **
  • Posts: 143
Re: Items fail to add to cart in https ssl
« Reply #23 on: August 13, 2018, 12:37:14 pm »
Assistance required again for the same issue (automatic redirection from http to https)

mysite.com & http://mysite.com redirect to https://www.mysite.com ---> fine
www.mysite.com or http://www.mysite.com doesn't ---> how to make this happen?


Studio 42

  • Contributing Developer
  • Sr. Member
  • *
  • Posts: 3389
  • Joomla & Virtuemart addon developper
    • Studio 42 - Virtuemart & Joomla extentions
  • VirtueMart Version: 2.6 & 3.0.x.y
Re: Items fail to add to cart in https ssl
« Reply #24 on: August 13, 2018, 15:04:23 pm »
Assistance required again for the same issue (automatic redirection from http to https)

mysite.com & http://mysite.com redirect to https://www.mysite.com ---> fine
www.mysite.com or http://www.mysite.com doesn't ---> how to make this happen?
# 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]

This redirect any to https://yoursite.com
And dont redirect to WWW, it's completly stupid to use this, if you dont need for technical reason!!!!

rage76

  • Jr. Member
  • **
  • Posts: 143
Re: Items fail to add to cart in https ssl
« Reply #25 on: August 13, 2018, 17:48:22 pm »
Thanks for a quick response Studio 42.

After going through numerous popular websites, I feel it is better to have www prefixed to the domain, as all of them are still using it; don't you think?

So, as per you I need to use this:

# 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]

How do I change it to include www?

Studio 42

  • Contributing Developer
  • Sr. Member
  • *
  • Posts: 3389
  • Joomla & Virtuemart addon developper
    • Studio 42 - Virtuemart & Joomla extentions
  • VirtueMart Version: 2.6 & 3.0.x.y
Re: Items fail to add to cart in https ssl
« Reply #26 on: August 13, 2018, 17:57:32 pm »
Try
RewriteEngine on
RewriteCond %{HTTP_HOST} ^yoursite.com [NC]
RewriteRule ^(.*)$ https://www.yoursite.com/$1 [L,R=301,NC]

rage76

  • Jr. Member
  • **
  • Posts: 143
Re: Items fail to add to cart in https ssl
« Reply #27 on: August 13, 2018, 18:49:34 pm »
www.mysite.com is still not getting redirected to https://www.mysite.com

Studio 42

  • Contributing Developer
  • Sr. Member
  • *
  • Posts: 3389
  • Joomla & Virtuemart addon developper
    • Studio 42 - Virtuemart & Joomla extentions
  • VirtueMart Version: 2.6 & 3.0.x.y
Re: Items fail to add to cart in https ssl
« Reply #28 on: August 13, 2018, 20:26:40 pm »
Have you this rules at begin of .htaccess?
Try then
 RewriteEngine on
 RewriteCond %{HTTP_HOST} !^www.yoursite.com [NC]
 RewriteRule ^(.*)$ https://www.yoursite.com/$1 [L,R=301,NC]