URL Rewrite Non Existing Requests [NginX]

Rewrite all requests which no longer exist to domain.

server {
    server_name  www.xxxxxxxxxx.xx;
    location ~* ^.*(/|\..*) {
        rewrite ^ $scheme://xxxxxxxxxx.xx permanent;
    }
}