Empty Cart - Admin Logout - Canonical URL Issue

Article Details
URL: index.php?_m=knowledgebase&_a=viewarticle&kbarticleid=81
Article ID: 81
Created On: 28 Aug 2013 04:23 PM

Answer Questions:
  1. 'Your cart is empty' error while checking out.
  2. Sometimes Admin session expires.

If you are facing any of the above issues on your store, then your store might be facing URL canonicalization problem.

Which means that, you might be trying to access 'http://yourdomain.com' but you gets redirected to 'http://www.yourdomain.com' or vice versa due to your store's configuration.

You can see that there is a difference between the two URLs. One has www and another doesn't have. And both might create separate sessions and cookies for the same visitor.


To solve this problem, we recommend that you pick a canonical (preferred) URL as the preferred version of your website.

And edit the following configuration files of your Avactis store,

In above files, change the 'HTTP_URL' and 'COOKIEDOMAIN', 'HTTPS_URL' and 'SiteURL' respectively to your preferred URL i.e. with WWW or without WWW.


Once you have decided the preferred URL, then ask your hosting provider to add a 301 Permanent Redirection for your website from other URL to your preferred URL. This can be done by adding any one of the following code in .htaccess file of your server's root public directory.


If your site is hosted on Apache server, you can redirect from the WWW to the non-WWW, or vice versa, with a few lines in your .htaccess file.

Redirect WWW to non-WWW:

<IfModule mod_rewrite.c>
RewriteEngine On
RewriteCond %{HTTP_HOST} !^(yourdomain\.com)?$
RewriteRule ^(.*)$ http://yourdomain.com/$1 [R=301,L]
</IfModule>

Redirect non-WWW to WWW:

<IfModule mod_rewrite.c>
RewriteEngine On
RewriteCond %{HTTP_HOST} !^(www\.yourdomain\.com)?$
RewriteRule ^(.*)$ http://www.yourdomain.com/$1 [R=301,L]
</IfModule>

Fore more details and other methods please refer this article: http://authoritylabs.com/blog/solving-canonical-problems/