9951 explained code solutions for 126 technologies

nginxHow to redirect entire domain to another domain

server {
  listen 80;
  server_name old.com;
  return 301 $scheme://new.com$request_uri;
}ctrl + c
server {

virtual server configuration block


current domain to redirect from

return 301

use 301 redirect code


new domain to redirect to


use same scheme for new domain (e.g. if HTTPs is used)


use same URL for new domain