| From | Sent On | Attachments |
|---|---|---|
| altiamge | Feb 25, 2012 7:59 pm | |
| António P. P. Almeida | Feb 25, 2012 8:40 pm | |
| Edho Arief | Feb 25, 2012 10:09 pm | |
| Edho Arief | Feb 25, 2012 10:19 pm | |
| altiamge | Feb 25, 2012 11:26 pm | |
| Edho Arief | Feb 25, 2012 11:28 pm | |
| Mark Alan | Feb 26, 2012 4:18 am | |
| António P. P. Almeida | Feb 26, 2012 6:38 am | |
| Edho Arief | Feb 26, 2012 6:41 am | |
| altiamge | Feb 26, 2012 3:38 pm | |
| António P. P. Almeida | Feb 26, 2012 4:20 pm | |
| altiamge | Feb 26, 2012 4:25 pm | |
| António P. P. Almeida | Feb 26, 2012 4:40 pm | |
| altiamge | Feb 26, 2012 5:14 pm | |
| Max | Feb 26, 2012 10:33 pm | |
| António P. P. Almeida | Feb 27, 2012 2:12 am | |
| Max | Feb 27, 2012 7:46 pm | |
| António P. P. Almeida | Feb 28, 2012 4:09 am |
| Subject: | Regular Expression global redirect | |
|---|---|---|
| From: | altiamge (ngin...@nginx.us) | |
| Date: | Feb 25, 2012 7:59:08 pm | |
| List: | ru.sysoev.nginx | |
I'm using nginx as a reverse proxy for about 2000 websites. I'm trying to find a good way to redirect all www traffic to nonwww addresses. I don't want to have a separate entry for every domain...just a global redirect in the server block preferably. I found lots of examples to do this one domain at a time, but does anyone have any suggestions on how to do it for the whole server?
I was thinking of extracting the domain something like this then using an if statement, but I understand that if's are not recommended:
server_name ~^(\.)?(?<domain>.+)$;
thanks, altimage
here's my server block:
server { listen 80; server_name _;
location / { proxy_pass http://websites; } }
Posted at Nginx Forum:
http://forum.nginx.org/read.php?2,222984,222984#msg-222984
_______________________________________________ nginx mailing list ngi...@nginx.org http://mailman.nginx.org/mailman/listinfo/nginx





