Domain without the www?

February 21, 2017 168 views
DigitalOcean Ubuntu 16.04

I can not access my domain without the www, how to solve it?

4 Answers

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

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.

Thanks to all for the tips, I managed, configuring the www as a subdomain worked, thank you again.

Have another answer? Share your knowledge.