Hello,
I have a simple static website deployed to App platform.
The application has two domains attached: my-app.com and www.my-app.com
Both of them work well, however, I would like to setup a redirect of the www domain to non-www with 301 status code.
How can I configure this, please?
Thank you, Peter
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!
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.
Hello Peter,
If your domain nameserver record is pointing to DigitalOcean nameserver then you have to update the CNAME record in DigitalOcean cloud panel. you can follow below documentation link to add the CNAME record:
https://www.digitalocean.com/docs/networking/dns/how-to/manage-records/#cname-records
It will take 1-12 hours to propagate the changes then the subdomain should be resolving to the given hostname ( example: portfolio-12345.ondigitalocean.app)
Note that not all DNS providers support this method for root domains, known as CNAME flattening or using an ANAME or ALIAS record. I believe that GoDaddy does not support this yet.
What you could do instead, is to switch your DNS management to DigitalOcean:
ns1.digitalocean.com
ns2.digitalocean.com
ns3.digitalocean.com
That way when you add your non-www domain name to your App Platform, it will automatically take care of the DNS records for you.
Let me know if you have any questions!
Regards, Sri Charan