How to make a CNAME redirect to an external url

Hello people :slight_smile:

I have Virtualmin setup on my server ( Debian 6 x64 ) and I am trying to redirect one address from one of my domains to an external link.

I am trying to redirect test.mydomain.com to www.externalurl.com

The prefix test is of course not www or something like that, it’s like a sub server of the domain on its own.

I tried making a sub server then altered the dns records from virtualmin configuration but everytime I tried, test.mydomain.com redirected to another website on my server which was completely irrelevant ( I think this is a bug of Virtualmin because anytime I type “anything.domain.com” redirects to that particular web site on the server, apart from the actual domain and its www of course )

Any guidance would be appreciated. I already did this from my domain registrar’s panel but I had to use their DNS in order to have such options, so I switched the DNS’s back to mine and Im trying to figure it out how to do this on my own everytime I need it.

Thanks for your time!

The main problem presented here can have any number of reasons, to give some insight I’d need to know the concrete domain names and IPs involved, so that I can do some tests.

Apache showing a certain web page when it receives a request for an unknown domain is expected behavior. The alphabetically first virtual host in its config is used in this case.

I am using nginx, not Apache. This is not my primary concern though, because chances are most people won’t ever come across this behavior.

My main concern is for the CNAME to be correctly configured which I can’t do it by myself it seems. I can pm you the IP and domains involved if you want.

Okies, can’t say much about nginx unfortunately, have zero experience with that.

This forum doesn’t have a PM function, but if you like you could contact me via instant messenger, just tell me a screen name on a service of your choice, I guess have accounts on all of them. :slight_smile: