There are several domain names bound to my server.

I need to redirect requests like `domain.com` or `domain.com/` to `app.domain.com`.

Following is what I added in my app config:

```
server {
   listen 80;
   server_name main_domain.com domain.com;

   ... other lengthy directives ...       

   location = / {
      if ($host ~ 'domain.com') {
          return 302, http://app.domain.com;
      }
   }

   location / {
       try_fies $uri @app;
   }

   location @app {
       include uwsgi_params;
       uwsgi_pass unix:path_to/uwsgi.sock;
       uwsgi_intercept_errors on;
   }
} 

```

This made the redirection works, but requests to `/` of my other domain names all returned 404.

What can I do to make Nginx go on matching locations?