Skip to main content

A CNAME is NOT area redirect. A CNAME is a type of DNS entryrecord that tells the DNS resolver to do another DNS lookup under a different name.

A DNS record for a site often looks like:

example.com. IN A 69.9.64.11
www.example.com IN CNAME example.com.

That means that when a user types in example.com, then:

  1. The DNS client queries example.com and gets 69.9.64.11
  2. The web browser issues a request to 69.9.64.11 and sends the host namehostname example.com
  3. The web server returnreturns the index document
  4. The user sees the content and example.com in their URL bar

When the user tyestypes in www.example.com then

  1. The DNS client queries www.example.com and is told to look at example.com
  2. The DNS client queries example.com and gets 69.9.64.11
  3. The web browser issues a request to 69.9.64.11 and sends the host namehostname www.example.com
  4. The web server returnreturns the index document
  5. The user sees the content and www.example.com in their URL bar

If you want to redirect one to the other, you don't need to change DNS at all. 301 redirects can be implemented regardless of DNS configuration. Both A records and CNAME records work fine. If you want to use 301 redirects from www.example.com to example.com then the steps that are taken when a user types in www.example.com would be:

  1. The DNS client queries www.example.com and is told to look at example.com
  2. The DNS client queries example.com and gets 69.9.64.11
  3. The web browser issues a request to 69.9.64.11 and sends the host namehostname www.example.com
  4. The web server returns a 301 redirect to http://example.com/
  5. The DNS client queries example.com and gets 69.9.64.11
  6. The web browser issues a request to 69.9.64.11 and sends the host namehostname example.com
  7. The web server returnreturns the index document
  8. The user sees the content and example.com in their URL bar

To make this work, your webserver needweb server needs to be configured to issue the 301 redirect response unless the domain name is canonical.

A CNAME is NOT are redirect. A CNAME is a type of DNS entry that tells the DNS resolver to do another DNS lookup under a different name.

A DNS record for a site often looks like:

example.com. IN A 69.9.64.11
www.example.com IN CNAME example.com.

That means that when a user types in example.com, then:

  1. The DNS client queries example.com and gets 69.9.64.11
  2. The web browser issues a request to 69.9.64.11 and sends the host name example.com
  3. The web server return the index document
  4. The user sees the content and example.com in their URL bar

When the user tyes in www.example.com then

  1. The DNS client queries www.example.com and is told to look at example.com
  2. The DNS client queries example.com and gets 69.9.64.11
  3. The web browser issues a request to 69.9.64.11 and sends the host name www.example.com
  4. The web server return the index document
  5. The user sees the content and www.example.com in their URL bar

If you want to redirect one to the other, you don't need to change DNS at all. 301 redirects can be implemented regardless of DNS configuration. Both A records and CNAME records work fine. If you want to use 301 redirects from www.example.com to example.com then the steps that are taken when a user types in www.example.com would be:

  1. The DNS client queries www.example.com and is told to look at example.com
  2. The DNS client queries example.com and gets 69.9.64.11
  3. The web browser issues a request to 69.9.64.11 and sends the host name www.example.com
  4. The web server returns a 301 redirect to http://example.com/
  5. The DNS client queries example.com and gets 69.9.64.11
  6. The web browser issues a request to 69.9.64.11 and sends the host name example.com
  7. The web server return the index document
  8. The user sees the content and example.com in their URL bar

To make this work, your webserver need to be configured to issue the 301 redirect unless the domain name is canonical.

A CNAME is NOT a redirect. A CNAME is a type of DNS record that tells the DNS resolver to do another DNS lookup under a different name.

A DNS record for a site often looks like:

example.com. IN A 69.9.64.11
www.example.com IN CNAME example.com.

That means that when a user types in example.com, then:

  1. The DNS client queries example.com and gets 69.9.64.11
  2. The web browser issues a request to 69.9.64.11 and sends the hostname example.com
  3. The web server returns the index document
  4. The user sees the content and example.com in their URL bar

When the user types in www.example.com then

  1. The DNS client queries www.example.com and is told to look at example.com
  2. The DNS client queries example.com and gets 69.9.64.11
  3. The web browser issues a request to 69.9.64.11 and sends the hostname www.example.com
  4. The web server returns the index document
  5. The user sees the content and www.example.com in their URL bar

If you want to redirect one to the other, you don't need to change DNS at all. 301 redirects can be implemented regardless of DNS configuration. Both A records and CNAME records work fine. If you want to use 301 redirects from www.example.com to example.com then the steps that are taken when a user types in www.example.com would be:

  1. The DNS client queries www.example.com and is told to look at example.com
  2. The DNS client queries example.com and gets 69.9.64.11
  3. The web browser issues a request to 69.9.64.11 and sends the hostname www.example.com
  4. The web server returns a 301 redirect to http://example.com/
  5. The DNS client queries example.com and gets 69.9.64.11
  6. The web browser issues a request to 69.9.64.11 and sends the hostname example.com
  7. The web server returns the index document
  8. The user sees the content and example.com in their URL bar

To make this work, your web server needs to be configured to issue the 301 redirect response unless the domain name is canonical.

Source Link
Stephen Ostermiller
  • 99.4k
  • 18
  • 141
  • 364

A CNAME is NOT are redirect. A CNAME is a type of DNS entry that tells the DNS resolver to do another DNS lookup under a different name.

A DNS record for a site often looks like:

example.com. IN A 69.9.64.11
www.example.com IN CNAME example.com.

That means that when a user types in example.com, then:

  1. The DNS client queries example.com and gets 69.9.64.11
  2. The web browser issues a request to 69.9.64.11 and sends the host name example.com
  3. The web server return the index document
  4. The user sees the content and example.com in their URL bar

When the user tyes in www.example.com then

  1. The DNS client queries www.example.com and is told to look at example.com
  2. The DNS client queries example.com and gets 69.9.64.11
  3. The web browser issues a request to 69.9.64.11 and sends the host name www.example.com
  4. The web server return the index document
  5. The user sees the content and www.example.com in their URL bar

If you want to redirect one to the other, you don't need to change DNS at all. 301 redirects can be implemented regardless of DNS configuration. Both A records and CNAME records work fine. If you want to use 301 redirects from www.example.com to example.com then the steps that are taken when a user types in www.example.com would be:

  1. The DNS client queries www.example.com and is told to look at example.com
  2. The DNS client queries example.com and gets 69.9.64.11
  3. The web browser issues a request to 69.9.64.11 and sends the host name www.example.com
  4. The web server returns a 301 redirect to http://example.com/
  5. The DNS client queries example.com and gets 69.9.64.11
  6. The web browser issues a request to 69.9.64.11 and sends the host name example.com
  7. The web server return the index document
  8. The user sees the content and example.com in their URL bar

To make this work, your webserver need to be configured to issue the 301 redirect unless the domain name is canonical.