What is CName record and how does it work

What is CName record

What is CName record

A CNAME record is like a forwarding address for websites. Imagine you have a website at example.com, and you also want people to reach the same website by typing www.example.com. Instead of creating a separate setup for www.example.com, you use a CNAME record to tell the internet, “If someone asks for www.example.com, just send them to example.com.”

How It Works

  1. Creating the Shortcut:
    • You set up a CNAME record to create an alias or shortcut. In this case, www.example.com becomes an alias for example.com.
  2. When Someone Visits the Alias:
    • When someone types www.example.com into their browser, the CNAME record automatically redirects them to example.com.
  3. Resolving the Final Destination:
    • The internet then looks up example.com to find the actual location (IP address) of your website and takes the visitor there.

Simple Example

  • If you own example.com and want people to also find your site using shop.example.com, you can create a CNAME record for shop.example.com that points to example.com. Now, anyone who types shop.example.com will end up at example.com.

Key Takeaways

  • Alias: A CNAME record is like a nickname for your domain.
  • Redirection: It automatically redirects one domain name to another.
  • Efficiency: It’s useful for managing multiple domains that lead to the same place.

This makes it easier to manage your website and ensures that all the different ways people might type your website address lead them to the right place.