I have 2 different domains (www.mysite.com and www.mysite.it) associated at 2 different Store View (code=en and code=it). After set from backend my Magento 1.9.0.1 to works with different domains, I set my .htaccess to redirect to the right store view and the right associated domain:
SetEnvIf Host www\.mysite\.com MAGE_RUN_CODE=en
SetEnvIf Host ^mysite\.com MAGE_RUN_CODE=en
SetEnvIf Host www\.mysite\.it MAGE_RUN_CODE=it
SetEnvIf Host ^mysite\.it MAGE_RUN_CODE=it
This works well except for one thing:
if I type mysite.com/myproduct-name or mysite.it/myproduct-name without www it brings me to the respective homepage (www.mysite.com and www.mysite.it).
How can set it so that redirect me to the www version of the content (e.g. www.mysite.com/myproduct-name)?
Edit
Ok, I think this is the problem, this is hot .htaccess part:
RewriteCond %{HTTP_HOST} !^mysite.it$ [NC]
RewriteRule ^(.*)$ http://www.mysite.it/ [R=301,L]
# RewriteCond %{HTTP_HOST} !^mysite.com$ [NC]
# RewriteRule ^(.*)$ http://www.mysite.com/ [R=301,L]
SetEnvIf Host www\.mysite\.com MAGE_RUN_CODE=en
SetEnvIf Host ^mysite\.com MAGE_RUN_CODE=en
SetEnvIf Host www\.mysite\.it MAGE_RUN_CODE=it
SetEnvIf Host ^mysite\.it MAGE_RUN_CODE=it
- In this situation redirect of product is resolved but I can access only to www.mysite.it
- If I uncomment row 3 and 4 I'm not able to access both domains anymore.
- If I remove ! from both conditions I can access to both domains but redirect to www product page doesn't work anymore
Where am I wrong?