Question

How to redirect traffic from www to root domain on app platform?

Posted May 7, 2021 269 views
DNS

I deployed my django app successfully on App platform. I added my root domain. The challenge I have is users who access web app with www included are shown a cloudflare page: ERROR 1: DNS RESOLUTION ERROR.
I added www as a CNAME record but things are not working.
Digital ocean support agents have not been helpful on this

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

Hello,
App platform can not redirect the www request to non-www request. Either you will have to configure the www domain in your App like you have set up the root domain or you can set up and droplet with Nginx or apache where you can redirect the www domain to the root domain.

https://www.digitalocean.com/community/tutorials/how-to-redirect-www-to-non-www-with-nginx-on-centos-7

https://medium.com/@kandros/redirect-www-traffic-to-non-www-with-ubuntu-and-nginx-9f05281ef944

Thanks
Mohsin Saeed

by Mitchell Anicas
This tutorial will show you how to redirect a www URL to non-www, e.g. `www.example.com` to `example.com`, with Nginx on CentOS 7. We will also show you how to redirect in the other direction, from a non-www URL to www.
  • @MohsinAwan For the App, do you mean just add the www.domainname.com as another domain and that is all, or is there more steps?

    • Yes, You will need to add it to just another domain. If your domain is using the DigitalOcean Name Servers then you will only have to add the domain name to your App settings But if your domain is using Name Servers other then Digital Ocean, Then you will need to create a CNAME record first pointing towards the App URL and then add the domain to your App.