Author: Piet Delport
Date: 23-09-02 13:59
As you know, FreshPorts is accessible with or without the "www." prefix to its domain name.
This is a Good Thing, but in the long run, not having a canonical hostname causes some problems. Probably most notable is that caching proxies can't know, in general, when two hostnames actually refer to the same underlying site, which leads to inefficient caching (in the worst case, everything can get cached twice, or once for each different hostname).
This can be easily avoided, while keeping the site accessible through both hostnames, by making one of the hostnames a redirect to the other. This can be accomplished by placing something like the following in Apache's httpd.conf:
NameVirtualHost 216.187.87.230
<VirtualHost 216.187.87.230>
ServerName www.freshports.org
[...rest of settings...]
</VirtualHost>
<VirtualHost 216.187.87.230>
ServerName freshports.org
Redirect permanent / http://www.freshports.org/
</VirtualHost>
(...or the other way around, if you prefer it without the www. prefix, like i do. I saw that the FreshPort report mails refer to www.freshports.org, though.)
With the above in place, a request of "http://freshports.org/foo/bar" will instantly redirect the browser to "http://www.freshports.org/foo/bar".
|
|