Hello,
i know this question is current, but i have an error when updating cart.
I have make a new template with Themler, and when put a product in cart, it use the javascript method.
I have tested my site in local mode, and the function work fine, but when i am in live, i have the error :
XMLHttpRequest cannot load https://www.energie-sante.ch/index.php?option=com_virtuemart&nosef=1&view=c...ty%5B%5D=1&option=com_virtuemart&view=cart&virtuemart_product_id%5B%5D=340. No 'Access-Control-Allow-Origin' header is present on the requested resource. Origin 'https://energie-sante.ch' is therefore not allowed access.
But i dont understand why it work on local and not in live ???
Any idea ?
I have VM 3.0.18 and Joomla 3.6.5
Regards
Is the https can be cause problem ?
Hello again, i have find the problem. It is www and non www conflict.
I have to find how i can fix it now
Here we are !
I have make a htaccess redirection (http://dense13.com/blog/2008/02/27/redirecting-non-www-to-www-with-htaccess/) and now all my non www is redirected at www and my problem is gone. :)
You should do it exactly the opposite. Dont use www, it is old. And please be a aware, the add to cart for the product works with the form. So using a js should just fire the form
Hello, i have say JavaScript but I don't know anything in coding...
If a put non www, it don't work because VM try to call a www URL.
But I don't know where I can change this. You have the URL in my post before.
Hello again, i have made some tests and i can't find where is the configuration for this call.
The problem is here : If i am in the site wit URL without www, i can't load to cart. If i am with www, it is OK.
You can see in my screenshot the error when i am in non www url. You see Virtuemart can't load https://www.energie-sante.ch...... Because origin (i dont understand what is it) is https://energie-sante.ch
So for now, the only way i have is to force non www to www.
Can somebody tell me an idea to find where i can define it will be the https://energie-sante.ch wich is called for load ?
I can't load attachment... upload folder is full... So link to my screenshot : http://energie-sante.ch/media/energie-sante-2.jpg
if u force no www doesn't it work?
the 'call' is the add to cart form which should take your "root" url
<form method="post" class="product" action="#">
Hello,
no, i have already tested it :)
OK, but the "Root" url, i can define it ?
I have try in the "Live site" in the configuration.php but dosent work...
if u set it by htaccess it should be global
it takes what was requested
remove "Live site" -- only causes problems
OK, but how can i set in htaccess ?
Here is my htaccess :
### ===========================================================================
### Security Enhanced & Highly Optimized .htaccess File for Joomla!
### automatically generated by Admin Tools 3.6.6 on 2015-12-18 09:56:02 GMT
### Auto-detected Apache version: 2.5 (best guess)
### ===========================================================================
###
### The contents of this file are based on the same author's work "Master
### .htaccess", published on http://snipt.net/nikosdion/the-master-htaccess
###
### Admin Tools is Free Software, distributed under the terms of the GNU
### General Public License version 3 or, at your option, any later version
### published by the Free Software Foundation.
###
### !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! IMPORTANT !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
### !! !!
### !! If you get an Internal Server Error 500 or a blank page when trying !!
### !! to access your site, remove this file and try tweaking its settings !!
### !! in the back-end of the Admin Tools component. !!
### !! !!
### !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
###
##### RewriteEngine enabled - BEGIN
RewriteEngine On
##### RewriteEngine enabled - END
## Send ETag (selected method: )
##### Rewrite rules to block out some common exploits -- BEGIN
RewriteCond %{QUERY_STRING} proc/self/environ [OR]
RewriteCond %{QUERY_STRING} mosConfig_[a-zA-Z_]{1,21}(=|\%3D) [OR]
RewriteCond %{QUERY_STRING} base64_(en|de)code\(.*\) [OR]
RewriteCond %{QUERY_STRING} (<|%3C).*script.*(>|%3E) [NC,OR]
RewriteCond %{QUERY_STRING} GLOBALS(=|\[|\%[0-9A-Z]{0,2}) [OR]
RewriteCond %{QUERY_STRING} _REQUEST(=|\[|\%[0-9A-Z]{0,2})
RewriteRule .* index.php [F]
##### Rewrite rules to block out some common exploits -- END
##### Advanced server protection rules exceptions -- BEGIN
##### Advanced server protection rules exceptions -- END
##### Advanced server protection -- BEGIN
##### Advanced server protection -- END
##### Joomla! core SEF Section -- BEGIN
RewriteRule .* - [E=HTTP_AUTHORIZATION:%{HTTP:Authorization}]
RewriteCond %{REQUEST_URI} !^/index\.php
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule .* index.php [L]
##### Joomla! core SEF Section -- END
#RewriteCond %{HTTP:X-Forwarded-Proto} !https
#RewriteRule (.*) https://www.energie-sante.ch/$1 [R=301,L]
RewriteCond %{HTTP_HOST} !^www\.
RewriteRule ^(.*)$ https://www.%{HTTP_HOST}/$1 [R=301,L]
#Force non-www:
#RewriteCond %{HTTP_HOST} ^www\.energie-sante\.ch [NC]
#RewriteRule ^(.*)$ http://energie-sante.ch/$1 [L,R=301]
#RewriteCond %{HTTP_HOST} !^www\.
#RewriteRule ^(.*)$ https://www.%{HTTP_HOST}/$1 [R=301,L]
#Force non-www:
RewriteCond %{HTTP_HOST} ^www\.energie-sante\.ch [NC]
RewriteRule ^(.*)$ http://energie-sante.ch/$1 [L,R=301]
Yes, I have already try this, that's why it is in my htaccess, but VM still want call www.
then needs further investigation on YOUR site.. no one else reports this problem so it is site specific, -- template, plugin etc etc
Ok, I will try to investigate. I come back when further informations
Thank you
Hello,
when i try to do www => non www, i have now another error :
Mixed Content: The page at 'https://energie-sante.ch/accueil-boutique/consommables-argent-colloidal.html' was loaded over HTTPS, but requested an insecure XMLHttpRequest endpoint 'http://energie-sante.ch/index.php?option=com_virtuemart&nosef=1&view=cart&t...255D=1&option=com_virtuemart&view=cart&virtuemart_product_id%255B%255D=208'. This request has been blocked; the content must be served over HTTPS.
But the first error not appear
EDIT : No, it because i have modify the url in the Google search console to define non www. But dosent work...
I think You should check that You don´t have this:
Quote
#Force non-www:
RewriteCond %{HTTP_HOST} ^www\.energie-sante\.ch [NC]
RewriteRule ^(.*)$ http://energie-sante.ch/$1 [L,R=301]
It should probably say https://.... :)
regards
Jörgen @ Kreativ Fotografi
Yes, i have see it after and try to modify, but the problem still here.
But the main problem is why it will call www on my cart button. It is this i have to find.... I have try with the Protostar template and the problem still here, so not a template problem.
OK, i have make a new site and now it work when i am in non www. But it dosent work when in www, because error of mixed content...
I dont understand but have forced https and non www.
EDIT : I have put only the https redirection and it seem to be ok now with and without www.
Can somebody make a test and tell me if he can add to cart with and without www please : https://www.energie-sante.ch/accueil-boutique/consommables-argent-colloidal
Thanks a lot by advance
Yes, can add on www and non www