Mobile app version of vmapp.org
Login or Join
Lee4591628

: Despite adding a CNAME record for a subdoman, the webserver is showing the server's default host I want one subdomain to point to another on the same domain. DNS Records Type

@Lee4591628

Posted in: #Apache #Dns #Virtualhost

I want one subdomain to point to another on the same domain.

DNS Records

Type Name Value
-----------------------------------------
A s1.example.com 10.20.30.40
CNAME s2.example.com s1.example.com


s1.example.com has a valid A record. If I go to s2.example.com I get the server's default virtual host.

What is the correct way to achieve this? Am I doing this wrong by attempting this via the DNS records? Do I need to set up a ServerAlias in the virtual host for s1.example.com instead?

10.01% popularity Vote Up Vote Down


Login to follow query

More posts by @Lee4591628

1 Comments

Sorted by latest first Latest Oldest Best

 

@Alves908

No. Sorta. It appears, you are, in effect, trying to use DNS as a redirect. That does not work.

If this is what you are trying to do, you will need to add your s2.example.com site to your web server and put in a redirect from one to the other into an .htaccess file or better yet, just map the s2 site file system directory to the s1 directory.

The reason why you are getting a so-called default site, is because if a site does not exist on Apache, it will return the first site created. For some Apache installs, this is a catch-all site. For the others, it is the first site you create yourself.

10% popularity Vote Up Vote Down


Back to top | Use Dark Theme