boris_atw
boris_atw

Reputation: 253

DNS without www is not working

I've got a domain name that is perfectely reachable using http://www.example.com

I would like that this same domain would be reachable using http://example.com

Unfortunately, with my actual DNS config, it doesn't work. Here what I have in DNS configuration :

*   CNAME   www
www CNAME   address_my_domain.

I was thinking that the wildcard would redirect to www, but it seems that I'm wrong... What can I define in my DNS to have the site accessible without www ? Thanks for help

Upvotes: 13

Views: 41885

Answers (3)

Carlos Ferreira
Carlos Ferreira

Reputation: 2078

This is what worked for me. I was using AWS Amplify with GoDaddy and I configured my DNS records with these two entries to get it working.

Type  Name  Data
CNAME *     dk************nes.cloudfront.net.
CNAME www   dkihdeom86nes.cloudfront.net.

Initially I only had the www entry which is why it wasn't working for me.

To test it make sure you open an incognito or private browser window to remove caching.

Upvotes: 0

Nima
Nima

Reputation: 190

So you actually don't need either of those records, the https:// and www. are not relevant, you can just make the root of your zone point to the ip of your site via an A record:

@ IN A ip-address

Where in place of @ you can put the full address of your zone, e.g. example.com., but usually the @ symbol is recognized as the zone root. If your site is actually hosted using another domain then that's tricky, because your zone root cannot be the name of a CNAME, e.g. you can't have

@ IN CNAME site.address

You would have to have something like

portal.example.com IN CNAME site.address

Adding some more details:

The reason your site is resolving at www.example.com is because you added a record named www on you zone example.com, and www.example.com is the record that has the CNAME to your site, but example.com is the root of your zone and is a record in itself, it does not have a CNAME to your site so that's why it's not going there, the http:// is irrelevant to the DNS records, your zone apex record, @ or example.com cannot itself be a CNAME, so your possible solutions are designating a record to be the CNAME for the site, e.g. portal IN CNAME site.address, where people would use portal.example.com to access your site, or depending on the DNS software you're using, you can make an alias record that allows for an apex record to be a CNAME but through other fancy means, Amazon's Route 53 allows for this

Upvotes: 2

match
match

Reputation: 11070

You can use wildcards to add subdomains, but not to subtract them - e.g.:

*.example.com.   IN CNAME example.com.

You'll need an A record to point to the correct ip address for the 'base' domain:

example.com.   IN  A   1.2.3.4

Upvotes: 4

Related Questions