Forum Moderators: Robert Charlton & goodroi
That is where www.example.com/aboutus.html
appears in google's cache as being from www.domain.com/aboutus.html another virtual site on the same IP.
To answer your incredulous question I have seen it, in fact I have seen most of a large (tens of thousands pages of an ecommerce site) replicated as being part of a rather small site. There were other sites on that server that were also well mixed up. They were all using relative addressing in addition to being on a shared server IP You can draw whatever conclusions you wish from that.
It is kind of hard for a fully specified identifier to be misunderstood (I'm trying very hard to be nice here).
I also told you of a situation where relative urls were part of the mix of a mess.
If you go back into the archives of this site you'll see that at least one Google representive recommends the full specification of urls.
Why I haven't a clue but maybe they know of a gotcha.
I roll code so I love nonabsolute urls, but I have seen the results in realtime.
Oh from a site level an absolute url stops the splitting of a site along the www/non-www line of split sites.
[edited by: theBear at 1:43 am (utc) on Nov. 30, 2006]
I'd advise you to build s canonical URL by using either the SERVER_NAME or HTTP_HOST variable, rather than taking your chances with an HTTP response that depends on the client for resolution.
Even if someone answers authoritatively that Google will accept a relative-URL response today, that could easily change tomorrow.
Jim
14.30 LocationThe Location response-header field is used to redirect the recipient to a location other than the Request-URI for completion of the request or identification of a new resource. For 201 (Created) responses, the Location is that of the new resource which was created by the request. For 3xx responses, the location SHOULD indicate the server's preferred URI for automatic redirection to the resource. The field value consists of a single absolute URI.
Location = "Location" ":" absoluteURI
An example is:
Location: [w3.org...]
I think it's rather irrelevant whether Google handles an incorrectly-formed response they way you'd like them to or not.
Your PHP code is broken. It would be perfectly legitimate for the PHP library, your webserver, Google, or any client, to simply reject this and flag it as an error. And in a perfect world, they all would.
Alternately, a given web server, module, plug-in, programming library, could permit a relative URL to be given and fill in the missing part itself. You will have to look at the details of your particular server, etc. to determine that.
Bottom line is, the Location field in the HTTP response is specified as an absolute URI. The action of a given browser or spider, given an incorrect HTTP response is "undefined".
[edited by: jtara at 2:03 am (utc) on Nov. 30, 2006]
But as per the information provided in this thread and the information I've found elsehwere, it seems that although there is no definite answer and relative paths "might" be all right, you are leaving it up to the user agent to fill in the domain. This is probably all right, but why take that chance.
So therein lies the difference: If you send a 301 redirect with a relative url, it is up to the user agent to decide what to put ahead of the path. If you specify, then you have a uniform redirect that cannot be incorrectly completed.
That being said if you use Google sitemaps and have specified a www or non-www preference and use a relative 301 redirect, and just found this thread and wish to switch to absolutes to be on the safe side, the chances are you didn't mess anything up by using relative urls to begin with, so there is no need to fret.
[edited by: Decius at 1:59 am (utc) on Nov. 30, 2006]
A redirect from page1.html to page2.html will work for both:
domain.com/page1.html ---> domain.com/page2.html
and for
www.domain.com/page1.html ---> www.domain.com/page2.html
In both cases you probably wanted www.domain.com/page2.html as the final result. Only an absolute URL can do that.