httpd-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Daniel Aleksandersen <>
Subject [users@httpd] Content-Location header instead of 301 redirect for www.
Date Thu, 13 Mar 2008 14:08:55 GMT
On 2008-03-12, Daniel Aleksandersen wrote:
> 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?

I have come up with something on my own, but I need some help with the 
variables and syntaxes. (Marked below with dollar signs and uppercase.)

  Header unset Content-Location
  Header set Content-Location "http://www.domain.tld/$relativeURI"

I hope someone can understand what I tried to write above, and could help 
me finish it. Thanks in advance,

> 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:
Daniel Aleksandersen –

The official User-To-User support forum of the Apache HTTP Server Project.
See <URL:> for more info.
To unsubscribe, e-mail:
   "   from the digest:
For additional commands, e-mail:

View raw message