Hello Oceaners,

My client have happy.com and want to use my website builder system.
My domain is example.com.

I need to redirect happy.com to happy.example.com. By the way I use nginx. What DNS records and rewrite rules I must use?


These answers are provided by our Community. If you find them useful, show some love by clicking the heart. If you run into issues leave a comment, or add your own answer to help others.

Submit an Answer
2 answers
server {
   listen 80;

   server_name happy.com;

   return 301 $scheme://happy.example.com$request_uri;


by Justin Ellingwood
HTTP redirects are used to redirect web site visitors to new locations when they request content. These are useful for a variety of reasons, whether permanent or temporary. This guide will demonstrate how to redirect visitors using Apache and Nginx.

If happy.example.com is configured in nginx to use happy.com as another domain then you will just need your client to point their domain name to your server’s IP address or create a CNAME record to point it to happy.example.com.

Basically, on your end you’ll want to modify the line in your server block (in /etc/nginx/sites-enabled/) from:

server_name happy.example.com;


server_name happy.example.com happy.com;

Then restart nginx with service nginx restart

Your server will now be ready to accept requests for happy.com once your client’s DNS is updated.