Hi i need to blabla.example.org or dummy.example.org anotherdummy send
me to www.example.org (another words *.example.org must redirect to
www.example.org ) but when i type www.example.org it can’t send to
www.example.org cause it’s loop. Help me to realize this construction.
Posted at Nginx Forum:
shitit
October 31, 2010, 2:17am
2
On 30 Out 2010 19h08 WEST, [email protected] wrote:
Hi i need to blabla.example.org or dummy.example.org anotherdummy
send me to www.example.org (another words *.example.org must
redirect to www.example.org ) but when i type www.example.org it
can’t send to www.example.org cause it’s loop. Help me to realize
this construction.
Create two server blocks. Put the www server name before the * and it
should work:
See Server names
Exact names precede patterns or regex server names.
— appa
shitit
October 31, 2010, 8:11pm
3
On 31 Out 2010 03h48 WET, [email protected] wrote:
It doesn’t work. With server_name www.example.org and server_name
*.example.org my site doesn’t redirect blabla.example.org to
www.example.org
server {
listen [::]:80; # ipv6
server_name www.example.com;
(...)
}
server {
## This is to avoid the spurious if for sub-domain name
## rewriting. See Pitfalls and Common Mistakes | NGINX .
listen [::]:80; # ipv6
server_name *.example.com;
rewrite ^ $scheme://www.example.com$request_uri permanent;
} # server domain rewrite.
I haven’t tried it myself. Try it.
— appa
shitit
October 31, 2010, 4:50am
4
It doesn’t work. With server_name www.example.org and server_name
*.example.org my site doesn’t redirect blabla.example.org to
www.example.org
Posted at Nginx Forum: