Report this

What is the reason for this report?

Redirect www to naked domain

Posted on August 27, 2022

I have pointed the domain name servers to DO and I am trying to get the www subdomain to point to the naked domain. I have tried CNAME and A host but not luck. Is there a simple/straightforward way of having the www subdomain redirect or point to the naked domain?



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.

Hi @massiveseagreenray,

Through DNS you can point the www.domain.com record to the same one as domain.com.

After that you want when someone loads www.domain.com to redirect to domain.com, correct? If that’s the case, this redirect happens on a server level. You’ll need to put the redirect in Nginx or Apache2 depending on what you are using. The redirects are rarely done via DNS but from the server your app is being managed.

Hello @massiveseagreenray

If you’re using Nginx, take advantage of our NGINX tool and specify the redirection there.

https://www.digitalocean.com/community/tools/nginx

For Apache, you can do a basic 301 redirect rule in the .htaccess file or in the virtual host for the domain name.

Regards

The developer cloud

Scale up as you grow — whether you're running one virtual machine or ten thousand.

Start building today

From GPU-powered inference and Kubernetes to managed databases and storage, get everything you need to build, scale, and deploy intelligent applications.

Dark mode is coming soon.