I want to redirect Magento to open with www

asked Jan 8, 2013 in E-commerce by darkshark (1,500 points)
Hi ..
Just like the title indicates. I want to know how to redirect visitors to my site to open my site only with the ‘www’. Any help would be appreciated
Thanks and regards

1 Answer

0 like 0 dislike
answered Jan 8, 2013 by expert (14,380 points)
open your .htaccess file placed in the same folder  Magento is installed. Inside the .htaccess file locate the line containing  RewriteEngine on and right after that line add the following code:
RewriteCond %{HTTP_HOST} ^your-domain.com$ [NC]
RewriteRule ^(.*)$ http://www.your-domain.com/$1 [R=301,L]
Then save the .htaccess file, and log to your Magento admin area and go to  System -> Configuration menu and click the Web button from the left panel. Unfold the Unsecured options and edit the Base URL option from ‘http://your-domain.com’ to ‘http://www.your-domain.com’.
Finally save your changes.