Jakob
September 15, 2012, 7:58pm
1
I have set up a webshop at shopify.com . Let’s say my store is located at example.shopify.com .
I would like to run it on my own unique domain - let’s call it example.com .
I’ve now made a CNAME record to point www.example.com to example.shopfy.com - which works just fine.
My problem is that example.com (without “www”) does not work.
My question is what would be the best way to permanently redirect “example.com ” to “www.example.com ”? I’m looking for the best solution when also taking SEO into account. I don’t want to upset Google
Thanks in advance
Write this code in your .htaccess
Options +FollowSymlinks
RewriteEngine on
rewritecond %{http_host} ^example.com [nc]
rewriterule ^(.*)$ http://www.example.com/$1 [r=301,nc]
Jakob
September 17, 2012, 6:51pm
3
Thanks alisaparkar,
Looks like a good solution. Do you know if this would also be accepted by Google and the other search engines?
rpkamp
September 17, 2012, 6:58pm
4
Yes, 301 redirects indicate to google, “Please look over here instead.”, which Google happily accepts.
Although the code above works fine I’d suggest a few minor tweaks to make it a bit more efficient.
Options +FollowSymlinks
RewriteEngine On
RewriteCond %{HTTP_HOST} ^example\\.com [NC]
RewriteRule .? http://www.example.com%{REQUEST_URI} [L,R=301]