NGINX Redirect everything except one location

I have an average nginx server configuration for a PHP application.

I’m trying to redirect all requests to a new endpoint, except for one location block.

        location / { # redirect everything here
            return 301$request_uri;

        location /backend { # except for this endpoint
            try_files $uri $uri/ /index.php?$query_string;

        location ~ .php$ {
            root {{ app_path }}/_system/public;
            fastcgi_pass unix:/var/run/php/php5.6-fpm.sock;
            fastcgi_param SCRIPT_FILENAME $realpath_root$fastcgi_script_name;
            include fastcgi_params;

However I’m currently unable to do so.

From reading Nginx documentation I would assume the most specific location block would take precedence, so for any /backend request, /backend would be used.

But the requests is always being redirected (using location / block)

Is there any conflict in my configuration? Something I’m missing?

I’ve looked at a dozen plus ServerFault posts without success so far.

curl localhost/backend -I
HTTP/1.1 301 Moved Permanently