Posting in the Magento forums has been disabled pending the implementation of a new and improved forum solution which should better serve the community.

For new questions please post at magento.stackexchange.com, the community-run support site for the Magento community. We will be providing updates on the new forum solution soon. For questions or concerns please email community@magento.com.

Magento Forum

Implementing a 301 URL rewrite so all front-end URLs include “www”
 
NathanJ
Member
 
Total Posts:  44
Joined:  2008-04-07
 

Title says it all but…

This is good practice from an SEO standpoint. I don’t care about the backend URLs being standardized, but want to make sure that any crawlers or browsers are automatically sent to the “www” version of front end URLs, if they forget to type it or come in through a link that doesn’t include it.

I know I could just modify .htaccess to do this but I’m pretty lost when working with it, so I didn’t want to break any of the other SEF functionality.

Thanks!

 
Magento Community Magento Community
Magento Community
Magento Community
 
golles
Sr. Member
 
Total Posts:  257
Joined:  2008-01-15
 

this is how we do it: - place this in the .htaccess file (we have it at the top):

RewriteEngine On
RewriteBase /
RewriteCond %{HTTP_HOST} ^domainname\.co.uk$ [NC]
RewriteRule ^(.*)$ http://www.domainname.co.uk/$1 [R=301,L]

Obviously alter domainname to be you domain and change the .co.uk if you are on a .com domain

Hope this helps

 
Magento Community Magento Community
Magento Community
Magento Community
Magento Community
Magento Community
Back to top