How to redirect a Magento website to www?

0
159
Redirect Magento

Redirect MagentoMagento is an open source e-commerce platform. It provides a flexible shopping cart system with the control over the content and functionality of the online store. It also provides more powerful tools for marketing, catalog-management, and search engine optimization. Redirecting a Magento store to www can be helpful for SEO and other usability purposes. You can redirect the visitor to open the Magento store through www. It can be done by following two steps

Step 1: Using .htaccess

Open the .htaccess file in the root directory, and use the below code for redirecting to www in .htaccess file

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

Save the above code in .htaccess file.

Step 2: Login to Magento admin and Go to System Configuration -> Web

In the System Configuration, go to Web and click the tab “Unsecure”. In the tab, change the Base URL from http://yourdomain.com to http://www.yourdomain.com.
Click the button “Save Config” and now the updates are done. Now, the website starts working through www.yourdomain.com

LEAVE A REPLY

Please enter your comment!
Please enter your name here