In Magento, How to redirect all non www pages to www pages

In Magento this is how to redirect all non www pages to www pages using the .htaccess with an FTP client like FileZilla.

Open up .htaccess to edit the file then do a find in file and look for #RewriteBase.

#RewriteBase /magento/ under this line paste the following but remember to change www.youwebsite.com with your own URL.

RewriteCond %{HTTP_HOST} !^www.youwebsite.com$ [NC]

RewriteRule ^(.*)$ http://www.youwebsite.com/$1 [L,R=301]

After this we tend to run the following command via SSH:

php -f shell/indexer.php reindexall

That’s it, we always recommend backing up your files before making any changes.

If you need any help with Magento please contact us for pricing.

Ready to get started?

with over 20 years in the industry our designs, coding, and marketing services a future-proof.

Feel free to contact us today for a free site audit or to discuss your next project

Name*

Website

Email*

Telephone

Brief Overview