Map additional domains to existing ee site?

My client purchased some additional domains that they would like to direct to the current one. They initially setup a redirect at their registrar, i.e. 123.com -> abc.com but the page load is terrible while the original abc.com loads very efficiently. Literally 10sec vs under 1sec.

The registrar support tech suggested simply pointing the additional domains to the same IP and handling the forward locally server side. I am not using WP multi-site for any of the existing sites I simply want to add additional domains to point to a single existing site while not affecting the other sites on the server. Also, I don’t care about the extra domains being retained in the url path after navigating around the site (it would be nice, but not necessary). Thanks.

There are two simple solution that I can think of.

The first one is create 123.com site with nginx and redirect to abc.com

  • Create the site

nano /etc/nginx/sites-available/123.com

server {

server_name 123.com;

rewrite ^ http://abc.com;

}
  • Enable the site

ln -s /etct/nginx/sites-available/123.com /etc/nginx/sites-enabled/123.com

  • Reload nginx

service nginx reload

The second solution is just add 123.com to abc.com

nano /etc/nginx/sites-available/abc.com or ee site edit abc.com

server_name abc.com 123.com;
  • Reload nginx
    service nginx reload

IMHO, from SEO point of view, the first solution would be a better choice.

Thanks faizi,

The first one works great. I had tried it the second way but nginx wouldn’t restart so I thought I did something wrong until I checked the logs and found it was all due to a long domain name due to how nginx caches the domain names. An edit to nginx.conf server_names_hash_bucket_size 128; was the fix for that.