Content-Location header instead of 301 redirect for www.

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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@xxxxxxxxxxxxxxxx
   "   from the digest: users-digest-unsubscribe@xxxxxxxxxxxxxxxx
For additional commands, e-mail: users-help@xxxxxxxxxxxxxxxx



[Index of Archives]     [Open SSH Users]     [Linux ACPI]     [Linux Kernel]     [Linux Laptop]     [Kernel Newbies]     [Security]     [Netfilter]     [Bugtraq]     [Squid]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Samba]     [Video 4 Linux]     [Device Mapper]

  Powered by Linux