Resolve domain.com but not www.domain.com

I was breaking my mind with setting up CNAME to resolve www.yunasch.ml as yunasch.ml.

I’m not using any special software with the web page.

So when I put the URL with the www. error displays “ERR_NAME_NOT_RESOLVED” and I don’t know how to setup the CNAME Records to solve that problem.

I tried this:

RECORD NAME www
DOMAIN yunasch.ml
DESTINATION (ip from main domain/dns name)

and it’s shown like this:
CNAME RECORD | DESTINATION
www.yunasch.ml. | (ip adrress main domain/dns name)

But nothing happened.

Also tried with RECORD NAME set as www.yunasch.ml, but the same.

Anyone has seen how does this work?

Thanks a lot and let me know if I did something bad.

Your domain is pointing to the Freenom’s nameservers right now. To point it to InfinityFree with both www and non-www versions you have to add two records on the DNS Management page for your domain on the Freenom’s Client Area:

1st record:

2nd record:

  • Name: www
  • Type: CNAME
  • TTL: 300
  • Value: yunasch.ml

After that, save the changes and use this htaccess code that you need to add with the File Manager creating the .htaccess file on the htdocs to redirect the www version of the website to the non-www one:

RewriteEngine On
RewriteCond %{HTTP_HOST} ^www\.yunasch\.ml [NC]
RewriteRule ^(.*)$ http://yunasch.ml/$1 [L,R=301]

and save the file. After those things, you should be able to access the website from both www and non-www versions, but the www version will redirect with a 301 Permanent Redirect to the non-www one!

1 Like

The first one says “invalid value record”

I said that on the first record the record is as type A and the value will be…

But seen that you didn’t read it, or used the one that is titled “Using ALIAS records”, let’s put the correct one here:

Using A records

Warning: the IP address of your account may change without warning or notification. Using our nameservers is recommended, and using CNAME records is preferred over using A records.

The IP address associated with a hosting account cannot be found in the control panel, but you can find it yourself. To do so, you will need to look up the IP address associated with your account’s main domain.

You can find the IP address using the dig utility installed on macOS or Linux, or use a web-based tool, like Google’s Dig tool. In the web tool, enter your account’s main domain, whose example is shown on the screenshot that is on that article, and click the button saying “A”. You can find the IP address in the resulting output.

For subdomains, you can create a CNAME record pointing your subdomain to the main domain of your account.

1 Like

I think is beacause the value is empty

I mean, name is Empty

Only the name will be left empty, and the value should be the IP you got from the dig, that should start with 185.27.134 and will not have any space before or after it.

1 Like

I was putting the DNS name, not the IP, sorry for that.

Let’s check if this works now.

1 Like

Now goes fine with www but dns name does not resolve without it…

Now it works on both versions, but just with bypassing the SSL certificate error. If you want a SSL certificate, consider using Let’s Encrypt one, seeing that you have custom nameservers, and with it, you can do the “Manual Verification (DNS)” method on sslforfree.com after inputting your domain name without www.

1 Like

Now I’m fighting with ZeroSSL and Infinity Free to install on my page. Thank you so much!! You helped me a lot :heart:

1 Like

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.