Knowledge Base Article

How to redirect Magento to open through www?

For SEO and usability purposes you may want to redirect your visitors to open your site only through http://www.yourdomain.com.

Some applications, including Magento, however, require additional modifications to make this redirection work properly.

First, you should open the .htaccess file in the Magento folder. In it locate the "RewriteEngine on" line and right after it add the following lines:

RewriteCond %{HTTP_HOST} ^yourdomain.com$ [NC]
RewriteRule ^(.*)$ http://www.yourdomain.com/$1 [R=301,L]


Once you do this, save the .htaccess file and log in to the administrative end of Magento.

Then go to the System > Configuration menu and from the left panel click the "Web" button.

Unfold the "Unsecured" set of options and change the "Base URL" option from http://yourdomain.com to http://www.yourdomain.com.

Save the changes and your Magento website will be running with www.yourdomain.com only!



Rating

Please indicate if this article was helpful for you.

rating :  4.6 from 5
views :  8615
votes :  36

Related Articles

Views

How to clear the cache in Magento? 26529
Magento Optimization 9596
How to configure Magento to work with a new domain or change its directory 9274
How to install Magento? 6431
How to upgrade Magento? 5689

Haven't found what you are looking for? Suggest an article HERE.

powered by

Valid XHTML 1.0 Strict Valid CSS!