Silent no-www flamboyancy
The whole www. or no-www. flamboywar is a bit dull. Anyhow, here is a tip that will configure Apache to inform users and search engines about the preferred location (aka. domain) of webpages.
Content-Location is a header from the HTTP standard that is intended to inform users about an alternate location of a resource without redirecting them.
The below scrip is placed in Apache’s /.htaccess configuration file. Apache 2.2.4 or newer required.
SetEnv absolutehost http://domain.tld/
SetEnvIfNoCase Host ^domain.tld$ absolutehosttrue=yes
SetEnvIfNoCase Request_URI \/(.*)\..* requesturi=$1
Header always unset Content-Location
Header always set Content-Location %{absolutehost}e%{requesturi}e env=!absolutehosttrue
To sum up what it does: It first stores the absolute host (domain name) in two enviromental variables. Then it checks whether the request was made from the absolute host or not, before it first unsets the Content-Location header and then sets the new header if the request was made from any host but the preferred host. Voila.
Copyright © 2008 Daniel Aleksandersen 2008-05-29 at 01:05
« Reply to “Making the World Wide Web an Easier Place to Talk About” | Home | Learning bash »Get a free subscription to new entries in the Open Source Notebook!
Runbox
- 10 GB email storage,
- 1 GB file storage,
- 100 MB attachment limit,
- your own domain,
...and more! Get your own premium email for just 49 USD per year!
Categories- Communication (24)
- Conquering the Command Line (12)
- Gadgets (13)
- K Desktop Environment (25)
- Multimedia (23)
- Online Privacy (9)
- Open Formats (24)
- Reviews (6)
- Shape of the World (28)
- Software (25)
- Ubuntu and Debian Watch (12)
- User Interface (26)
- Your Rights! (8)
The archive keeps a record of all entries that have ever been published! Have a look back in time, and see what was going on!
LicenseThis blog entry text is licensed under a Creative Commons Sampling Plus 1.0 License. The license explained, and legal notes.

Leave your comment