How to implement "www resolve" for a website hosted on IPFS?

Newbie here (to both IPFS and web development). I’ve a website hosted on IPFS. I tried adding an A record for www pointing to the IP address of the gateway. But it’s not working and resulted in the error: ipfs resolve -r /ipns/www.example.com: could not resolve name

How can I solve this? Any help will be appreciated.

Follow the instructions here: https://dnslink.io/. You need a TXT _dnslink record.

Thanks for the reply @hector.
I’ve already added a TXT record with _dnslink. But it’s only resolving example.com and not www.example.com. I’m using Cloudflare. What am I missing? Here are my records as of now:

you need a dns link with name _dnslink.example.com. and another as _dnslink.www.example.com..

Appreciate your help. I tried adding that TXT record and still it’s not working for me.

Visiting www.example.com is now giving me DNS_PROBE_POSSIBLE error on Brave browser.

bumping this up if anyone could help

You’re missing a “www” CNAME record, so your site is only accessible at the second level

DNS records…

  • A/AAAA … put the IP address of the IPFS gateway
  • CNAME … put the domain of the IPFS gateway
  • TXT … put _dnslink.domain.tld —AND— _dnslink.www.domain.tld

Example

A/AAAA Record
Hostname    IP Address
domain.tld  ipv4.address
domain.tld  ipv6.address

CNAME Record
Hostname	Aliases to
www           ipfs.io
      or
www           gateway.domain.tld

TXT Record
Hostname	Value

_dnslink      dnslink=/ipfs/Qmest...xW
_dnslink.www  dnslink=/ipfs/Qmest...xW