title: Nginx 301 redirection from subdomain to domain
body: <p>I have a subdomain "subdomain.domain.com" and I want to do a 301 redirection when a 404 error occurs and automatically redirect the user to "domain.com". How can I do it? I'm working with Nginx Server Blocks and I have two Server Block files one for "domain.com" and other for "subdomain.domain.com". Many thanks!</p>