Raja's Exocortex

Nginx Redirect Domain

Redirect all http/https requests for old-domain.com and www.old-domain.com to www.new-domain.com including the request URI.

server {
    listen 80;
    listen 443 ssl;

	root /dev/null;

	# Redirect all requests for old-domain.com to www.new-domain.com.
    server_name old-domain.com www.old-domain.com;
    return 301 $scheme://www.new-domain.com$request_uri;
}