I can not access my domain without the www, how to solve it?
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.
I wish there was a write up on this, but the best way I can describe this is to set up the DNS twice. That is, you log into your DO account, then go to networking. Create a DNS entry for www.mydomain.com and another one for mydomain.com. That is, the second entry doesn’t have a www.
Technically the www is a subdomain of mydomain.com. So if your www.mydomain.com works, just create another DNS without the www.
It could also be a DNS issue. Could you post what the zone file for example.com as I suspect the problem might have to do with A records. Thanks.
Hey there. This depends on how your website is configured. Are you using an CMS (Content Managment System)? And do you use Apache or Nginx as a web server?
If you are using Apache you can re-write www to non-www inside the .htaccess file in your web root (/var/www/html by default). I do this for my website as seen here on GitHub
Thanks to all for the tips, I managed, configuring the www as a subdomain worked, thank you again.
Join 1M+ other developers and: