DNS Records A vs CNAME

There was a time when I was pretty good at this stuff, but as the years creep by it’s more of a realization that if you don’t use it often, you could lose it.

I can’t seem to remember which DNS records I need to make the magic happen; I host my own website, and want my domain (which is hosted by Cloudflare) to resolve to the address needed for the site, while maintaining the domain name as the address.

I confuse myself, I get it. I have a hosted wordpress for my website, which can be accessed by (cannot use links). If someone types in the domain in their address bar, what records do I need to point that domain to my hosted site?

Cloudflare is definitely not hosting your WordPress site. While Cloudflare does offer some extremely specialized hosting, WordPress does not work with any Cloudflare hosting solutions. You can position the Cloudflare proxy between your visitors and the server that is hosting your WordPress site. That is an extremely common setup.

If your site is at the domain example.com and it is running on your web server at you would want to create an A record for that name (represented by @ since it is the apex) using that IP. If your host listens on an IPv6 address, you would need to create an AAAA record instead.

If you also wanted www.example.com to send people to the same website, you can create a CNAME for that name that points to example.com. Your server should now what to do with requests for www.example.com. Normally you would pick one name and redirect the other to it.

This Community #tutorial covers the process in more detail.

I apologize, I didn’t mean to state that Cloudflare was hosting my wordpress site. They host my domain name that I would like to connect to a self-hosted URL.

No worries. If your site is on the public internet and has working SSL, you should be good to go with the creation of an A record that contains your site name and your server IP.

Which is what I tried, but it needs to connect to an IP with a \wordpress at the end. Can an A record help there, too?

example: server-ip\wordpress

No. DNS resolves hostnames to IPs. It will not return a path or URI.

If your WordPress site is installed in the /wordpress directory of your site at example.com you would need to type example.com/wordpress into the browser to visit the site.

If you want to access the WordPress site at the apex name example.com you need to fix the configuration on your origin server first. How to move your WordPress from a subdirectory to the root is beyond the scope of Cloudflare, but should not be too hard to accomplish.

Honestly, I sort-of figured that would be the case, but I wanted to reach out to be sure. That certainly helped, I can stop banging my head on the desk in trying to figure it out. Thank you!

1 Like

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