With or Without You WWW February 19, 2006
(Visited 21572 times)Dupe (duplicate) content found on several pages just makes your page lower in ranking than actually making it higher in SERPs (Search Engine Results Pages). Duplicate content is like diluting the focus on a single page since there are many other similar pages. So if you have been doing this with multiple domains, do not do it and better have them redirected using a redirect 301. If you do not know how to do this, there are several ways to do it, doing in the httpd.conf file in Apache, doing a couple of lines in .htaccess, or using headers in server side programming languages like ASP, JSP, PHP, Miva, Cold Fusion, Perl etc.
So dupe content is a no-no. But isn’t most of our webhost have both http://domain.com and http://www.domain.com show the same page with or without the “www”? If we can control how everyone links to your page and uses only one format, lets say, with the “www” only, that would be great. But sometimes some people will link to you without it. So as search engines crawl, they see two URLs. http://www.domain.com and http://domain.com are actually different, but the search engines will see dupe content. That is like decreasing your own pagerank. (If page rank still really matters to you. Hehe)
On many web hosting companies, for sure modifying the httpd.conf will not be allowed and you can do a .htaccess by simply uploading one but if you do a simple redirect 301 in the .htaccess for http://domain.com to forward to http://www.domain.com and these URLs show the same page, sometimes doing this on a web host will just make the page not visible at all because it will keep on reloading the page and will just stop.
If you do not own your server and want to do something like that, you can use a server-side language supported by your web host company. Since most web host have PHP, my example below is for PHP.
$_SERVER[HTTP_HOST] = strtolower($_SERVER[HTTP_HOST]);
if($_SERVER[HTTP_HOST]==”actiononline.biz”) {
header(”HTTP/1.1 301 Moved Permanently”);
header(”Location: http://www.actiononline.biz”);
exit();
}
This should work perfectly. If your web host does not have PHP, they should have at least one of the following: JSP, ASP, ASP.net, Perl, Cold Fusion, Miva and they should be able to have some equivalent code for this. It works perfect for me on http://actiononline.biz and forwards to http://www.actiononline.biz. Of course, place the code in the middle of the PHP starting and ending angled brackets with question marks and place this on the very beginning of your homepage. It should be the first thing, even before the DTD.
- Posted in : SEO News
- Author : Benj Arriola

Comments»
Someone told me the script does not work, they did a copy and paste on the code above.
I checked it out too. And I found out the double quotes are not just plain text double quotes.. So just delete the quotation marks and change them with the right ones in a plain text editor or your favorite HTML editor. I think TinyMCE changed it which is a part of WP2.0.
Since I suck at .htaccess using the regex syntax for URLs… I will show you a link also of another SEOPhilippines.org member who posted this site on the mailing list. Exact same thing using .htaccess files.
http://www.kabarkada.com/archives/24
i think this code might help as well….
Brilliant ! I have the same problem on my site so this is a great help!
thanks for this. Will implement and see what happens.
Update… as discussed in the mailing list:
$_SERVER[HTTP_HOST] = strtolower($_SERVER[HTTP_HOST]);
if($_SERVER[HTTP_HOST]==”actiononline.biz” or
$_SERVER[REQUEST_URI]==”/index.php”) {
header(”HTTP/1.1 301 Moved Permanently”);
header(”Location: http://www.actiononline.biz“);
exit();
}
So the index.php also forwards to the domain only without the index.php. Note: You can replace that with index.html or main.html what ever your DirectoryIndex is.
Here is my latest version and so far, the one I like the best:
$myIndexPage = “index.php”;
$myDomainName = “actiononline.biz”;
$_SERVER[HTTP_HOST] = strtolower($_SERVER[HTTP_HOST]);
if($_SERVER[REQUEST_URI]==”/”.$myIndexPage or $_SERVER[REQUEST_URI]==”/”.$myIndexPage.”/”){
header(”HTTP/1.1 301 Moved Permanently”);
header(”Location: http://www.“.$myDomainName);
exit();
}
if($_SERVER[HTTP_HOST]==$myDomainName) {
header(”HTTP/1.1 301 Moved Permanently”);
header(”Location: http://www.“.$myDomainName.$_SERVER[REQUEST_URI]);
exit();
}
[…] redirect or not, like when you want to the referring URL before you redirect, or the user agent. Trackback· […]
so basic yet a good information you got here…
never thouhgt of how to use the 301 redirect becausei never knew how it works..
now is the time to use it..i’ll just do a little research on it for finess.