.htaccess and redirect for SEO
I've been reading about SEO and found it is recommended to redirect all http://domain.com domains to http://www.domain.com.
this can be done a few ways. the one i'm trying out is doing it via .htaccess.
RewriteEngine on
RewriteCond %{HTTP_HOST} yourdomain\.com [NC]
RewriteCond %{HTTP_HOST} !^www\.yourdomain\.com [NC]
RewriteRule ^(.*) http://www.yourdomain\.com/$1 [L,R=301]
more info can be found here: http://www.stonetemple.com/articles/301-redirects.shtml
Thought people may find it useful, i'm going to try this out for a while on one site and then if successfull wiill use it as part or every .htaccess file.
Does anyone have any experience with this and is it worth adding to the default typolight .htaccess file as standard?
Ben
Re: .htaccess and redirect for SEO
Hi Ben,
We use this method for every site we produce.
It is critical, as search engines including Google treat a domain with and without www. as two entirely separate domains.
The effect of this is that potentially you are dividing your domain strength by two, and of course have two duplicates of each page of your site, leaving Google to decide which is the most important and should rank highest. Both pages could be ranked on page two of the results pages, but if your method is adopted then one page could be pushed to page one.
Although posted in 2007, I explain this better here http://www.phoenixrealm.com/duplicate-content-problem/ and it's still relevant.
I would like to see it added to the default .htaccess
Gary
Re: .htaccess and redirect for SEO
Hi Gary,
I'll definitely be using this in all my .htaccess files from now on.
I like your accessibility features on your website. http://www.doublespark.co.uk/
Can this be achieved in Typolight websites?
Did you code it all yourself or is it available somewhere on the web?
Cheers
Ben
Re: .htaccess and redirect for SEO
Hi Ben,
It is all bespoke coding. We are intending to launch an updated site later this year using TL and it probably will not have the same accessibility features. Mainly just because it's time for a change, as I'm sure same thing can be achieved with TL.
It's been a few years but I remember we started with a search for "css style switcher". I can see there are more modern php only solutions available, if I was to try this again I would look at that and reduce the reliance on JavaScript as much as possible. Big fan of jQuery so would also look at that for what was needed.
Re: .htaccess and redirect for SEO
I'm more in favor of the reverse. Make all www.domain.com requests goto domain.com. To me, www is a relic that is unnecessary in the modern web.