Question

How to redirect non-www to www in DigitalOcean App platform built website and Godaddy domain

Hi all,

I have designed a website using React and Django. Both end are working through DO app platform using github repositories. I have purchased the domain from Godaddy. Everything is finished now and I want to connect my domain to my website. I followed the DO instructions and changed the nameserver on Godaddy. The website is working now with https://www.example.com but it is not working with https://example.com. I want to redirect the non-www to www for anyone mistakenly tries that.

Problem is there is no way I could find in DO settings. I can’t create an ‘A’ redirect because the forwarded value is not an IP address but it is an url given by DO for the app. I cannot do that from godaddy settings ‘forwarding’ options because this just resets all the nameservers back to godaddy nameservers.

Is there a way to do this?


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.

Bobby Iliev
Site Moderator
Site Moderator badge
April 4, 2023

Hi there,

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: 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!

Best,

Bobby

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