A CNAME is not a redirect. When you use a CNAME, the traffic for both domains is sent to the same IP address. The behavior of the site that users see when you use a CNAME record is identical to what users see when you use an A
record with the IP address of the other server. The type of DNS record you use has no bearing on how your site behaves. You can't cause redirects with DNS alone.
It is up to the webserver how to handle traffic for two different domains. The webserver gets sent the host name for each request. The webserver can choose to:
- Show the same content for both domains
- Show different content for each domain
- Show content for one domain and redirect the other domain
- Show error messages for one or both domains.
Implementing a redirect for a domain is done through webserver configuration. You don't say which webserver software you are using, so I will just give general instructions. You have to set up two sites or virtual hosts one for each host. Then you need to configure one of them to redirect. That is usually a one line configuration option. For example in Apache, the virtual host configuration for the old site might look like
<VirtualHost *:80>
ServerName test1.example
Redirect / http://test2.example
</VirtualHost>
When you configure the redirect, you can choose to redirect to deep URLs or redirect everything to the home page. The Apache configuration shown above does deep redirects. It is almost always better to redirect to deep URLs. It hurts SEO to redirect to the home page of the new site and it confuses users.