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.) IF CONDITION (%{HTTP_HOST} !^www.aleksandersen.net$) THAN Header unset Content-Location Header set Content-Location "http://www.domain.tld/$relativeURI" END CONDITION; 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: > http://www.w3.org/Protocols/rfc2616/rfc2616-sec14.html#sec14.14 -- Daniel Aleksandersen – 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@xxxxxxxxxxxxxxxx " from the digest: users-digest-unsubscribe@xxxxxxxxxxxxxxxx For additional commands, e-mail: users-help@xxxxxxxxxxxxxxxx