CNAME for subdomain does not work - 404 Error

I have a subdomain hosted right now something like:

subdomain.domain.com

I need cdn-subdomain.domain.com to point to that same subdomain. However, when I create this DNS entry: Record Type: CNAME Record Data: cdn-subdomain Record Value: subdomain.domain.com

I get a 404 error not found when navigating to cdn-subdomain.domain.com - ANY ideas what I'm doing wrong?


Solution 1:

If you're getting a 404, your CNAME is working just fine. If the CNAME wasn't working, you'd get an error indicating that no server could be found.

You need to set up your web server to serve the content to both domains. In Apache, you'd use a ServerAlias directive to tell it that cdn-subdomain.domain.com is an alias of subdomain.domain.com.