| From | Sent On | Attachments |
|---|---|---|
| whiskybar | Feb 17, 2011 6:43 am | |
| Edho P Arief | Feb 17, 2011 6:46 am | |
| Jim Ohlstein | Feb 17, 2011 6:47 am | |
| Luit van Drongelen | Feb 17, 2011 6:49 am | |
| Dayo | Feb 17, 2011 7:03 am | |
| whiskybar | Feb 17, 2011 7:07 am | |
| Jim Ohlstein | Feb 17, 2011 7:08 am | |
| Igor Sysoev | Feb 17, 2011 7:14 am | |
| Dayo | Feb 17, 2011 7:33 am | |
| Francis Daly | Feb 17, 2011 7:51 am | |
| whiskybar | Feb 17, 2011 8:14 am | |
| Francis Daly | Feb 17, 2011 3:41 pm | |
| lifeisjustabout | Feb 18, 2011 9:34 am |
| Subject: | remove www from the url | |
|---|---|---|
| From: | whiskybar (ngin...@nginx.us) | |
| Date: | Feb 17, 2011 6:43:47 am | |
| List: | ru.sysoev.nginx | |
Hello everyone,
I used to use the following trick to cut the initial www. from the address so that www.mysite.com would redirect to mysite.com:
[code] server { server_name mysite.com www.mysite.com;
if ($host ~* www\..*) { rewrite ^(.*)$ $1 permanent; } [/code]
Well, this method no longer works. I do not know when it stopped working but I will get "The page isn't redirecting properly" in Firefox. It still puzzles me the documentation still implies this should work:
[quote]"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)"[/quote]
Why is that and more importantly, what trick should I use to redirect www.mysite.com --> mysite.com?
Thank you!
Posted at Nginx Forum:
http://forum.nginx.org/read.php?2,176137,176137#msg-176137
_______________________________________________ nginx mailing list ngi...@nginx.org http://nginx.org/mailman/listinfo/nginx





