Nginx: 301 Redirect To A Domain Name
To redirect all requests from one domain to another in Nginx, you can add the following code to your Nginx configuration file: server { listen 80; server_name olddomain.com; return 301 $scheme://newdomain.com$request_uri; } This code listens on port 80 and checks the hostname of incoming requests. If the hostname is “olddomain.com”, it returns a 301 redirect … Read more