Welcome to WebmasterWorld Guest from 54.198.93.179

Message Too Old, No Replies

www and non-www

What's the lowdown?

     
5:50 pm on Aug 29, 2005 (gmt 0)

10+ Year Member



Hi,

I've read a fair bit about Google crawling 2 "versions" of a site, one with and one without the "www.". After doing some research I can't seem to get a clear answer as to which "version" to redirect to which, i.e. which is the best to keep in Google and which to effectively trash (and why).

Is there a definitive answer to this?

1:30 pm on Sep 3, 2005 (gmt 0)

WebmasterWorld Senior Member rfgdxm1 is a WebmasterWorld Top Contributor of All Time 10+ Year Member



Neither is better. Choose one and stick with it. I'd recommend www.
1:41 pm on Sep 3, 2005 (gmt 0)



Everyone should wildcard-redirect example.com to www.example.com. GOD/Big bang I hate those sites that just leave out the www. subdomain. Don't ask me why, though...
10:54 pm on Sep 3, 2005 (gmt 0)

WebmasterWorld Senior Member rfgdxm1 is a WebmasterWorld Top Contributor of All Time 10+ Year Member



>GOD/Big bang I hate those sites that just leave out the www. subdomain. Don't ask me why, though...

To get hypertechnical, in certain cases there is no particularly good reason to use the www. Let's say I own example.com. If I have a FTP server at ftp.example.com, and the mail server is mail.example.com, then I SHOULD use www.example.com instead of example.com for the web server to be consistent. However, if all that is at example.com is a website, the www is superfluous.

HOWEVER, in ALL cases if there is a website on example.com (some people have domains used just for e-mail, etc.), then it is positively brain dead not to have www.example.com also resolve. I've seen webmasters who actually have made this error. In my case, I redirect all calls to root to www on my sites, and recommend this practice to all.

4:31 am on Sep 4, 2005 (gmt 0)

10+ Year Member



I've been using this code in my htaccess file and it is working like a champ. (This was recommended in another thread)

RewriteCond %{HTTP_HOST} .
RewriteCond %{HTTP_HOST} !^www\.site\.com [NC]
RewriteRule ^(.*)$ [site.com...] [R=301,L]

Can anyone comment if this is indeed the best way to handle non www?

-Patrick

4:34 am on Sep 4, 2005 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Everyone has their own opinion on this. I prefer NO www. I don't guess it really matters. Just pick one and stick with it.
5:04 am on Sep 4, 2005 (gmt 0)

10+ Year Member



When you use the keyboard shortcut, ctrl+enter, when entering the domain name in the address bar of most browsers, the www is automatically inserted along with the http and .com. For that reason alone, I go ahead and redirect all my sites to the www version.
5:48 am on Sep 4, 2005 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



For commercial stuff I use www. just because it's what users have been trained to see, but it's all based on a long ago convention that should have been dumped long ago. ftp.site.com in most cases is not handled by the webserver, it's handled a little further down the line, the ftp request is sent to the ftp server, the rewrite part happens only when the web server is serving up the useragent request, makes no difference I've ever seen not having it, and having ftp, smtp, pop etc, all works fine. Some configurations may not of course. That's apache etc, no idea how IIS does ftp serving.

I wish sites didn't use that since it's just a waste of 4 characters, but since it's what people are used to, I use it on most sites.

5:51 am on Sep 4, 2005 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



but since it's what people are used to, I use it on most sites.

Most major sites do, too. Like Google and Yahoo. However, www is no different than any other sub domain. It's a sub domain, not the real deal. I guess that's why I prefer to go with the real deal. :)

8:02 am on Sep 4, 2005 (gmt 0)

10+ Year Member



Sorry, am a bit new to this issue - does it help in your rankings if you direct non-www to www? Do SE's prefer/reward you if you do this redirect?
10:27 am on Sep 4, 2005 (gmt 0)

10+ Year Member



It won't help directly, but it can prevent penalization for duplicate content.

Personally, I do it in PHP at the top of the global include file. The mod_rewrite way is more elegant and probably preferred.

<?php

if (!preg_match("/^www.site/i",$_SERVER['HTTP_HOST']) ) {
header("HTTP/1.1 301 Moved Permanently");
if (strlen($_SERVER['QUERY_STRING'])>0)
{
header("location:http://www.site.com$PHP_SELF?$_SERVER['QUERY_STRING']");
}
else
{
header("location:http://www.site.com$PHP_SELF");
}
exit;
}

10:29 am on Sep 4, 2005 (gmt 0)

10+ Year Member



>>>Is there a definitive answer to this?

GOOGLEBOT technology DOENT WORK!

10:30 am on Sep 4, 2005 (gmt 0)

10+ Year Member



it is a bit like my spelling does to much in a hurry to advance yet fails at the basics
12:28 pm on Sep 4, 2005 (gmt 0)

10+ Year Member



Hi,

I'm with you on that, Stinkfoot. But, it would only be true if we knew that Google IS affected by double listings. It's all speculation otherwise. I suppose it's hard to know whether setting up a redirect made any difference unless you later disable it and see what the result is. Has anyone done that?

One of my doubley listed sites is on an IIS server. I have a "DNS Zone Editor" as part of the hosting control panel, and one of the "Record Names" amongst "www" and "ftp" is the wildcard "*". I presume that if I disabled the "*" I would in effect block access to mydomain.co.uk? Not the same as a redirect I realise, but maybe equally effective? Otherwise, how can I redirect on IIS?

12:51 pm on Sep 4, 2005 (gmt 0)

10+ Year Member



Are there any sites which have different content on its www and non-www versions? I really want to see a notable site that seriously maintains 2 different sites on www and non-www.
1:13 pm on Sep 4, 2005 (gmt 0)

10+ Year Member



I'm working on the basis that if I search Google for site:www.mydomain.co.uk I get, say 75 pages for a particular site. Then, when I search for site:mydomain.co.uk, I get 100 pages in the results. The results for the latter case are the same as the former except that now they also include additional pages (i.e. none of which are repeats) whose URLs are of the non-www type.
1:21 pm on Sep 4, 2005 (gmt 0)

10+ Year Member



I want to see one good site which seriously maintains two different sub-domains, one on www and one on non-www.
If there are no such sites, then the question is who needs to change, billions of websites or google. Its easier for google to change than expect the world to change, even if google may be technically right.
2:33 pm on Sep 4, 2005 (gmt 0)

5+ Year Member



when i do a site:mydomain.com.au search on google it says 5,570 pages - I know we only have around 1700 pages for that site... why would Google think we have more? - and is this due to not having an HTACCESS redirect for non www. to include www.?

I can't get G to show me all the pages they think we have so can not see what pages need to be htaccess removed...

"Sorry, Google does not serve more than 1000 results for any query."

any ideas on how to fix that result number or is it something not to worry about?

2:54 pm on Sep 4, 2005 (gmt 0)

5+ Year Member



ok - I checked another site and again it shows on site:mydomain.com more pages than we have = 1620 - and shows listings with both www and without www ... when I search site:www.mydomain.com it shows only 460

So I am assuming G has double content indexed and we are being penalized - as that site does not get any traffic from G at all...

Will putting in this htaccess code sort Google out?:
RewriteCond %{HTTP_HOST} .
RewriteCond %{HTTP_HOST}!^www\.site\.com [NC]
RewriteRule ^(.*)$ [site.com...] [R=301,L]

will G drop the non www pages automatically? - or do I have to set up a "redirect gone" notice for all the non www page to get G to drop them?

4:08 pm on Sep 4, 2005 (gmt 0)

WebmasterWorld Senior Member jdmorgan is a WebmasterWorld Top Contributor of All Time 10+ Year Member



> or do I have to set up a "redirect gone" notice for all the non www page to get G to drop them?

No, just redirect them.

It's been said already, but if you permit two copies of each of your pages to exist, then you are relying on Google (and other engines) to post-process their crawl results and "figure out" that you have two (or more) URLs resolving to each page. So this means that if this post-processing fails --or if they don't have time to complete it-- you are risking having your PageRank/Linkpop split across two pages. So why risk it?

The reason for "www" is historic, and goes back to when a company might have two (or more) different servers for their domain -- One for internal private use (non-www) and one for public use (www). This was often done for security reasons and/or because the old servers didn't have the speed and disk capacity of today's machines that can often support dozens or hundreds of virtual servers. Today, most hosting companies use a one-size-fits-all approach, and simply set up both variants to resolve to the same host.

As to which variant you should use, that depends on whether you're setting up a new domain or 'fixing' an old one. If you're setting up a new domain, then pick one based on aesthetics and other factors such as existing branding in print media, etc. -- I think the above-mentioned point about browsers auto-prepending "www" on type-in domains is a good one too, but what's most important is that you pick one version and stick to it.

If you've got an existing domain, and incoming links are split across the www- and non-www variants, then a careful analysis of PageRank and link-popularity passed by those incoming links is in order. Check the PageRank of the pages linking to you, and weight them according to PR and "stability" of the linking site/page -- An incoming link with PR6 that you're sure will be maintained may be better than a link from a PR7 page that you don't expect to last more than a year, for example. Also, factor in the link text on those pages; Again an incoming link from a PR7 with good, specific link text may give you better results than a PR8 link with "good stuff" as the link text. Count the links on those pages that link to you, too; A PR7 page with five outgoing links and one to your site may be better than a PR8 page with one hundred links, one of which goes to your site. You need to do this same kind of analysis with Yahoo and MSN as well, although it's a bit harder without the toolbar PR-meter to give basic guidance; You have to count the incoming links of those pages that link to your site, and guesstimate the "quality" of those links.

Anyway, the question is --and especially for the Google-bashers-- "Do you want to rely on an extra search engine processing step to sort out your canonical domain, or do you want to declare it unambiguously?" If the latter, do a 301 redirect and, over time, get as many of the "wrong" links to your site corrected as possible.

Jim

4:34 pm on Sep 4, 2005 (gmt 0)

5+ Year Member



much clearer now - thanks :)

Am adding the htaccess redirects to use www. and hopefully over time this drops all the dupes.

6:52 pm on Sep 4, 2005 (gmt 0)



i just did this to a few sites... the redirect appears to work fine, but i got one error log message: "Options FollowSymLinks or SymLinksIfOwnerMatch is off which implies that RewriteRule directive is forbidden"

i'm trying to imagine what caused that error... i can't see the http.conf because it's a reseller account... i'm on an apache server.

9:19 pm on Sep 4, 2005 (gmt 0)

10+ Year Member



We seem to do this subject every three months. I say: to hell with www. I don't use it, and don't need it. Who in their right mind doubles the length of their address with all this doubleu doublue doublue dot?

I think the guys who say use it, mostly say that coz all their pages are configured that way, and they can't change 'em now.

Seems to me that with a fresh site, just skip them, and put a link on your home page pointing to itself. That'll tell even the dumbest robot what it's meant to prioritize.

10:29 pm on Sep 4, 2005 (gmt 0)

WebmasterWorld Senior Member jdmorgan is a WebmasterWorld Top Contributor of All Time 10+ Year Member



danimal,

Using the code posted in msg #19 above as a basis, simply add the line:


Options +FollowSymLinks

at the beginning.

As stated in the error message and in the mod_rewrite documentation [httpd.apache.org], the FollowSymLinks or SymLinksIfOwnerMatch option is required in order to use mod_rewrite.

Jim

3:12 am on Sep 5, 2005 (gmt 0)

10+ Year Member



Be aware that if you use FrontPage and use any of FP extensions--forms, shared borders, etc...you cannot use the Apache mod rewrite code and expect both to work....

BELIEVE ME..I know, I have spent 2 weeks un-doing a bunch of stuff. And my putting .htaccess redirect code in place opened several additional can-of-worms in my hosting co's tech support dept, problems that had to be solved that no one was even aware of, and it all took time even tho I get preferential treatment from them and they worked like crazy to get everything functioning correctly.

After a great deal of additional searching online, forums and Usenet, seems no one has found a reasonable FP and .htaccess redirect workaround.

When in place, the redirect from non-www to www worked just fine, but FP publish didn't and the extensions on the server had to be re-installed several times before we had it all working right in the end. Usually I had to have everything on the servers deleted--everything--and start over like it was a new site and let FP re-build all its quirky special files.

I had done the redirects on a bunch of sites and in some cases I ended up having to rebuild some old sites in newer versions of FP....lots of bother and we all learned a lot.

I know many people poo-poo FrontPage, but honestly, I, by myself, couldn't possibly manage as many sites as I do with out it. I know about bloated code and all that, I just strip the extra code out and just use it for the bare bones stuff I need.

Anyway--there is not much info online about the FP and mod rewrite problerms , so I thought I had better mention it and save people some real troubles.

3:44 am on Sep 5, 2005 (gmt 0)

WebmasterWorld Senior Member jdmorgan is a WebmasterWorld Top Contributor of All Time 10+ Year Member



shrimp,

You can the answer to mod_rewrite-Frontpage extension compatibility problems in the Apache forum, courtesy of members Bumpski and chopin2256. See message #43 of this thread [webmasterworld.com].

Jim

6:49 pm on Sep 5, 2005 (gmt 0)



thanks a bunch jim, i added that line to the .htaccess... it seems kinda weird that the error message has only shown up once in the error log.

i did have to add the line "RewriteEngine On" to get the redirection to work in the first place, but that's probably not relevant to this issue.

www vs. non-www? test that on any major website and you'll see it redirect to the www version... google, cnn, msn, etc.

front page tip appreciated as well!

8:30 pm on Sep 5, 2005 (gmt 0)

10+ Year Member



Thanks jdMorgan

Guess I'll have to put my thinkin' cap on and experiment with one of the less imp't sites to see if I can get it to work for me.
FP creates lots of those .htaccess files of its own to track down.

10:36 pm on Sep 5, 2005 (gmt 0)

WebmasterWorld Senior Member jdmorgan is a WebmasterWorld Top Contributor of All Time 10+ Year Member



danimal,

Good point about RewriteEngine on. Assuming that there is no other mod_rewrite code already present in .htaccess, the entire code snippet would look like this:


Options +FollowSymLinks
RewriteEngine on
RewriteCond %{HTTP_HOST} .
RewriteCond %{HTTP_HOST} !^www\.example\.com
RewriteRule (.*) http://www.example.com/$1 [R=301,L]

The first line won't be needed on many hosts, and may actually cause an error on others, depending on the server configuration. So it should be removed initially, and added back in if needed.

The first RewriteCond causes the rewrite to be skipped if the HTTP_HOST variable is blank. This can occur if the client (browser or robot) is a true HTTP/1.0 client and does not send the HTTP Host header with each request. Most HTTP/1.0 clients are now "Extended HTTP/1.0" and do send the header, since it's impossible to access most name-based virtual hosts without it. However, without this line, it would be possible for an HTTP/1.0 client (or a malicious user-agent) to cause errors on name-based virtual hosts which were assigned to unique IP addresses by putting the host into an "infinite" redirection loop. It's simply "an ounce of prevention."

The second RewriteCond says, "If the requested host is NOT www.example.com" (possibly followed by an optional port number). Literal periods in the hostname should be escaped as shown. I've changed it so that the match is no longer case-insensitive as well, but that's just a personal preference.

The RewriteRule then rewrites any request for any page in the "wrong" domain to the same page in the "right" domain. The same code can be used to do the rewrite from www to non-www simply by changing the "www.example.com" in both lines to "example.com". So, as before, I'm leaving that part of this discussion open.

Jim

10:32 am on Sep 6, 2005 (gmt 0)

10+ Year Member



I'm having some trouble with the code below:

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

The problem is with links that I've already made static (where I've removed the? = , etc.). Using the code above, the? and = returns at the end of the URL when the non-www is used. Any thoughts? Thanks!

This 31 message thread spans 2 pages: 31
 

Featured Threads

Hot Threads This Week

Hot Threads This Month