Home » Headline, Magento

Redirect Magento from non-www to www

15 October 2009 1,254 views One Comment














If you want to redirect your Magento site from a non-www, ex. http://yoursite.com to http://www.yoursite.com. There is a trick there.

  1. Enable Url rewriting (Admin Panel → System → Configuration → Web → Url Options → Use Web Server Rewrites → Yes).
  2. Now go to your .htaccess file on your Magento folder, (you might need to back up your .htaccess before making your changes.)

below the line # 123 code:

#RewriteBase /magento/

Add these codes, to make it:

#RewriteBase /magento/
RewriteCond %{HTTP_HOST} !^www\.yoursite\.com$ [NC]
RewriteRule ^(.*)$ http://www.yoursite.com/$1 [L,R=301]

Replace yoursite.com with your own domain. Then, save your changes on your .htaccess

1 Star2 Stars3 Stars4 Stars5 Stars (No Ratings Yet)
Loading ... Loading ...

One Comment »

  • David said:

    Great tutorial! Work like charm! Thank you ^^

Leave your response!

Add your comment below, or trackback from your own site. You can also subscribe to these comments via RSS.

Be nice. Keep it clean. Stay on topic. No spam.

You can use these tags:
<a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>

This is a Gravatar-enabled weblog. To get your own globally-recognized-avatar, please register at Gravatar.