VirtueMart Forum

VirtueMart 2 + 3 + 4 => General Questions => Topic started by: muzoid on April 09, 2012, 06:41:20 AM

Title: Add to cart only works without www prefix
Post by: muzoid on April 09, 2012, 06:41:20 AM
hi! 
I'm using Virtuemart 2.0.2 and Add to cart only works without www prefix.  In virtuemart admin panel, my shop URL is written with the prefix...quite lost here...
any clue?
Title: Re: Add to cart only works without www prefix
Post by: muzoid on April 09, 2012, 16:05:03 PM
Anyone?
Title: Re: Add to cart only works without www prefix
Post by: jenkinhill on April 09, 2012, 16:32:11 PM
Looks like something to do with the host environment. I notice that even if a product page is accessed using www. your product image urls do not include www. 

I believe one other has reported a similar problem.This workaround there was to add .htaccess to the Joomla root to force all urls to not use the www. prefix. Thus even if a vistor adds www. in the url when accessing the site it will be stripped out before they get to buy something.
Title: Re: Add to cart only works without www prefix
Post by: PRO on April 09, 2012, 16:32:44 PM
htaccess set to non www??
Title: Re: Add to cart only works without www prefix
Post by: muzoid on April 09, 2012, 16:39:10 PM
thanks a lot both of you for the quick reply...I've tried it but then got a 500 error...I don't know if my code is good though...is it OK?

Options +SymlinksIfOwnerMatch

RewriteEngine on

# Redirect addresses which are not hostname.com
RewriteCond %{HTTP_HOST}   !^\hostname\.com$ [NC]
RewriteRule ^(.*)$         http://hostname.com/$1 [R=301,L]
Title: Re: Add to cart only works without www prefix
Post by: PRO on April 09, 2012, 17:44:33 PM
Quote from: muzoid on April 09, 2012, 16:39:10 PM
thanks a lot both of you for the quick reply...I've tried it but then got a 500 error...I don't know if my code is good though...is it OK?

Options +SymlinksIfOwnerMatch

RewriteEngine on

# Redirect addresses which are not bisbeeoliveoil.com
RewriteCond %{HTTP_HOST}   !^\bisbeeoliveoil\.com$ [NC]
RewriteRule ^(.*)$         http://bisbeeoliveoil.com/$1 [R=301,L]


I meant is a redirect already in there.
Title: Re: Add to cart only works without www prefix
Post by: muzoid on April 09, 2012, 19:37:21 PM
problem solved with this code :

RewriteEngine On
RewriteCond %{HTTP_HOST} ^www.hostname.com [NC]
RewriteRule ^(.*)$ http://hostname.com/$1 [L,R=301]
Title: Re: Add to cart only works without www prefix
Post by: jenkinhill on April 09, 2012, 23:50:35 PM
Yes, that version looks good to go.