By basarozcan7
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?
regards
This textbox defaults to using Markdown to format your answer.
You can type !ref in this text area to quickly search our full set of tutorials, documentation & marketplace offerings and insert the link!
Accepted Answer
server {
listen 80;
server_name happy.com;
return 301 $scheme://happy.example.com$request_uri;
}
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;
to
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.
Get paid to write technical tutorials and select a tech-focused charity to receive a matching donation.
Full documentation for every DigitalOcean product.
The Wave has everything you need to know about building a business, from raising funding to marketing your product.
Stay up to date by signing up for DigitalOcean’s Infrastructure as a Newsletter.
New accounts only. By submitting your email you agree to our Privacy Policy
Scale up as you grow — whether you're running one virtual machine or ten thousand.
Sign up and get $200 in credit for your first 60 days with DigitalOcean.*
*This promotional offer applies to new accounts only.