Forum Moderators: phranque

Message Too Old, No Replies

using rewrite rule in my .htaccess file

SEO redirect in .htaccess file

         

garryb

9:03 am on Apr 16, 2008 (gmt 0)

10+ Year Member



I have recently been advise to put a redirect in my .htaccess file to send anyone(or anything) looking for http://example.com to http://www.example.com.

A friend who is an "SEO Expert" said it would be good as both versions are currently found on search engines. He claims that both versions would compete against each other and that search engines may see duplicate content.

I have added the following to my .htaccess file:

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

If anyone has experience of doing similar please advise of the results.

[edited by: pageoneresults at 2:52 pm (utc) on April 16, 2008]
[edit reason] Examplified URI References [/edit]

g1smd

12:56 am on Apr 17, 2008 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member Top Contributors Of The Month



That's the correct thing to do. It fixes a number of problems.

The topic comes up several times per week here. Refer to the answers I have given several hundred times before over the last 4 or 5 years.

You might also want to fix up URLs to remove references to the "index" filenames too. That's another redirect rule that needs to go BEFORE the one that you already have. Example code gets posted at least weekly.