Page 1 of 1

Error undefined on add to cart, compare and add to wishlist when using www.mysite.com

Posted: Fri Mar 19, 2021 5:48 pm
by Astromagical
Hi

I have looked through old forum posts and have got myself completely confused. :crazy: :crazy: ???

My site is https://savannahsunset.com on OC Version 3.0.3.6
When I use www. in front of my sitename the icons for Add to Car, Wishlist and compare are missing and I get an "error undefined" on the products on the home page. See image attached.

Looking through old forum posts it looks like I need to add something into the htaccess and possibly config files. Please can you help me by giving me exactly what I need to change and where to make the changes and in which files.

Thanks

Re: Error undefined on add to cart, compare and add to wishlist when using www.mysite.com

Posted: Fri Mar 19, 2021 7:36 pm
by xxvirusxx

Re: Error undefined on add to cart, compare and add to wishlist when using www.mysite.com

Posted: Fri Mar 26, 2021 5:46 pm
by Astromagical
xxvirusxx wrote:
Fri Mar 19, 2021 7:36 pm
viewtopic.php?t=183503
Thanks for this but it is precisely the reason I got confused - it does not help me in any way as there is so much code and no real solution.
Please help.
I need in detail how to make the website work with both https://www.mydomain.com as well as the default of https://mydomain.com. It is not the http to https - I have both working on https. I need to know how to get the site to accept the www and provide all the functionality I get without it.

Re: Error undefined on add to cart, compare and add to wishlist when using www.mysite.com

Posted: Mon Mar 29, 2021 2:43 am
by ADD Creative
Lots of different ways to do that. One such example. After RewriteEngine On.

Code: Select all

RewriteCond %{HTTP_HOST} ^www\.yourdomain\.com$ [NC]
RewriteRule ^(.*)$ http://yourdomain.com/$1 [L,R=301]

Re: Error undefined on add to cart, compare and add to wishlist when using www.mysite.com

Posted: Thu Apr 08, 2021 6:42 pm
by Astromagical
Thank you for the help

Re: Error undefined on add to cart, compare and add to wishlist when using www.mysite.com

Posted: Thu Jul 22, 2021 10:20 pm
by EvolveWebHosting
The solution above looks a little bit incomplete.

Add this to .htaccess (the RewriteBase / should already be there so add the two lines below it)
RewriteBase /
RewriteCond %{HTTP_HOST} !^www\.
RewriteRule ^(.*)$ https://www.%{HTTP_HOST}/$1 [R=301,L]

Then make sure www is included in the HTTP and HTTPS URL section of both config.php files.