1 (edited by Popov 2009-03-09 10:42)

Topic: SEO canonical 301 redirect

Hello,

As you know some search engines can penalize your site for duplicate content.
The reason is that they see these URL like different pages:

forexsb.com
forexsb.com/
www.forexsb.com/
www.forexsb.com
forexsb.com/index.html
www.forexsb.com/index.html

To prevent this I found .htaccess 301 redirection script in the net. It does this job as well as it redirects the sub domains properly also. I'm currently using this script on my website.


Options +FollowSymLinks 
RewriteEngine on 

RewriteCond %{THE_REQUEST} ^.*index\.html\ HTTP/
RewriteRule ^(.*)index\.html$ /$1 [R=301,L]

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

This code redirects all the shown URLs to:

http://forexsb.com/

Here you are how it works:

URL to check : http://www.forexsb.com/index.html

URL: http://www.forexsb.com/index.html ... redirected (301)

URL: http://www.forexsb.com/ ... redirected (301)

URL: http://forexsb.com/ ... found.

Well, I'm not an Apache guru so I would like to comment this script against possible issues.

Best Regards!

I'm using PunBB at Forex Forum since 2006.

2

Re: SEO canonical 301 redirect

Another way to safely tell the searchers what your url should be is to include this link in the header section of the web page:

<head>
     ...
     <link rel="canonical" href="http://forexsb.com/" />
     ...
</head>
I'm using PunBB at Forex Forum since 2006.