Redirect www to non-www for static website on App platform


I have a simple static website deployed to App platform.

The application has two domains attached: and

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

Submit an answer

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!

Sign In or Sign Up to Answer

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.

Sri Charan Madhavapeddi
DigitalOcean Employee
DigitalOcean Employee badge
April 26, 2023

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:

It will take 1-12 hours to propagate the changes then the subdomain should be resolving to the given hostname ( example:

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:

  • First add your domain name to your DigitalOcean account
  • Then add any of your existing DNS records that you might need like an MX record for example
  • Finally update your nameservers to:

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

Try DigitalOcean for free

Click below to sign up and get $200 of credit to try our products over 60 days!

Sign up

Get our biweekly newsletter

Sign up for Infrastructure as a Newsletter.

Hollie's Hub for Good

Working on improving health and education, reducing inequality, and spurring economic growth? We'd like to help.

Become a contributor

Get paid to write technical tutorials and select a tech-focused charity to receive a matching donation.

Welcome to the developer cloud

DigitalOcean makes it simple to launch in the cloud and scale up as you grow — whether you're running one virtual machine or ten thousand.

Learn more
DigitalOcean Cloud Control Panel