[gcompris-devel] Sugguest to redirect the pages under URL "www.gcompris.net" to URL "gcompris.net"

littlebat dashing.meng at gmail.com
Mon Mar 1 04:14:18 UTC 2010


I found a page under " http://gcompris.net/ " can also be visited under " http://www.gcompris.net/ ". This is the problem called "Duplicate content"( http://www.google.com/support/webmasters/bin/answer.py?hl=en&answer=66359 ). So, I suggest do a "301 redirects"( http://www.google.com/support/webmasters/bin/answer.py?answer=93633 ).

Below is a .htaccess file under Linux host for reference:  

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

some flags above explanation ( http://httpd.apache.org/docs/2.0/mod/mod_rewrite.html ) :
[NC] 'nocase|NC' (no case)
This makes the Pattern case-insensitive, ignoring difference between 'A-Z' and 'a-z' when Pattern is matched against the current URL.

[L] 'last|L' (last rule)
Stop the rewriting process here and don't apply any more rewrite rules. This corresponds to the Perl last command or the break command in C. Use this flag to prevent the currently rewritten URL from being rewritten further by following rules. For example, use it to rewrite the root-path URL ('/') to a real one, e.g., '/e/www/'.

[R=301] 'redirect|R  [=code]' (force redirect)
Prefix Substitution with http://thishost[:thisport]/ (which makes the new URL a URI) to force a external redirection. If no code is given, a HTTP response of 302 (MOVED TEMPORARILY) will be returned. If you want to use other response codes in the range 300-400, simply specify the appropriate number or use one of the following symbolic names: temp (default), permanent, seeother. Use this for rules to canonicalize the URL and return it to the client - to translate ``/~'' into ``/u/'', or to always append a slash to /u/user, etc.
Note: When you use this flag, make sure that the substitution field is a valid URL! Otherwise, you will be redirecting to an invalid location. Remember that this flag on its own will only prepend http://thishost[:thisport]/ to the URL, and rewriting will continue. Usually, you will want to stop rewriting at this point, and redirect immediately. To stop rewriting, you should add the 'L' flag.

 
View HTTP Request and Response Header: http://web-sniffer.net/ 


-- 
littlebat <dashing.meng at gmail.com>




More information about the Gcompris-devel mailing list