httpd-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Daniel Aleksandersen <aleksandersen+apache....@runbox.com>
Subject [users@httpd] Content-Location header instead of 301 redirect for www.
Date Wed, 12 Mar 2008 15:14:59 GMT
Hi list, (UTF‐8 encoded)

Currently I use the following to trigger a 301 redirect when users request 
my domain without the www. prefix.
  RewriteCond %{HTTP_HOST} !^www.example.tld$ [NC]
  RewriteRule ^(.*)$ http://www.example.tld/$1 [R=301,L]

After reading up on the HTTP/1.1 specification lately, I came across 
the “Content-Location” header. It is used to inform a user‐agent of the 
actual location (it’s absolute URI) of a resource. I see that my server 
sends it when I use mod_negotiate. But it only contains a relative URI.

Is it possible to include the absolute URI in the Content-Location header 
when users request a resource from a host other than www.example.tld?

So when a user requests GET /article from www.example.tld, she would get 
the responds «200 OK, Content-Location: /article.html» (set by 
mod_negotiate), but when she made the same request from example.tld, she 
would get «200 OK, Content-Location: http://www.example.tld/article.html»

Any ideas how this can be achieved?

The advantages of the Content-Location instead of 301 approach would be 
that the user would be spared a redirect, but still know the “most 
appropriate” location of a resource on the server. This is of course 
mostly for search engine optimisation purposes.

Read up on the Content-Location header:
http://www.w3.org/Protocols/rfc2616/rfc2616-sec14.html#sec14.14
-- 
Daniel’s Linux blog – http://www.opensource-notebook.com/

---------------------------------------------------------------------
The official User-To-User support forum of the Apache HTTP Server Project.
See <URL:http://httpd.apache.org/userslist.html> for more info.
To unsubscribe, e-mail: users-unsubscribe@httpd.apache.org
   "   from the digest: users-digest-unsubscribe@httpd.apache.org
For additional commands, e-mail: users-help@httpd.apache.org


Mime
View raw message