Rewriting request to www.domain.com to domain.com
António P. P. Almeida
appa at perusio.net
Mon Jan 31 17:02:10 MSK 2011
On 31 Jan 2011 13h11 WET, appa at perusio.net wrote:
> On 31 Jan 2011 10h53 WET, zblut at cerego.com wrote:
>
> Your rewrite doesn't work because you're not passing along the
> request URI available in the $request_uri variable.
>
> Use 2 server blocks:
>
server {
## This is to avoid the spurious if for sub-domain name
## rewriting. See http://wiki.nginx.org/Pitfalls#Server_Name.
listen 80;
server_name www.foobar.com;
rewrite ^ $scheme://foobar.com permanent;
} # server domain rewrite.
I've read incorrectly what you want to do. You just want to
redirect all www.foobar.com requests to the root foobar.com. Then the
above works.
--- appa
More information about the nginx
mailing list