remove www from the url
francis at daoine.org
Fri Feb 18 02:42:06 MSK 2011
On Thu, Feb 17, 2011 at 03:51:33PM +0000, Francis Daly wrote:
> But it looks to me as if the behaviour you see is to be expected, based
> on the documentation you quote:
[from http://wiki.nginx.org/HttpRewriteModule#rewrite ]
Note that if a redirect is relative (has no host part), then when
redirecting Nginx uses the "Host" header if the header match name of
server_name directive or the first name of server_name directive, if
the header does not match or is absent. If no server_name is set, then
the local hostname is used. If you want Nginx to always use the "Host"
header, you can use a wildcard "*" server_name (but see the restrictions
on doing so).
> Other than a little bit of grammar, the documentation looks correct.
Actually, now that I look at it again and actually *test*, I believe
this documentation is wrong -- at least as it relates to 0.9.4.
Reality seems to be more like
Note that if a redirect is relative (has no host part),
then Nginx generates the host part based on the value of
which now defaults to "off".
That linked documentation says
If server_name_in_redirect is on, then Nginx will use the first value
of the server_name directive for redirects. If server_name_in_redirect
is off, then nginx will use the requested Host header.
which is true, but an extra note like "if the first value of the
server_name directive used is not a plain hostname, then generated
redirects are not likely to be useful" might warn people against blindly
setting server_name_in_redirect on.
Could someone with wiki access verify that and update the pages?
Francis Daly francis at daoine.org
More information about the nginx