Help needed with nginx rewrite rules
So I've started playing around with nginx and wow did it decrease the load on my VPS compared to Apache2. I've come across one problem I can't solve with it though.
I have two domains - foo.com and bar.com. I want all requests for bar.com to redirect permanently to foo.com. I've got the following in my nginx.conf, but when I try to hit bar.com nginx complains about too many redirects and doesn't load foo.com.
rewrite ^ http://www.bar.com$request_uri? permanent;
Am I missing a step somewhere?