DNS: Point all subdomains to another subdomain except one

0

I am thinking of providing users their own personalized subdomain (ex. johndoe.mydomain.com) I understand I can do this with a wildcard CNAME entry. The problem is that I have another subdomain that I currently use for development (ex. dev.mydomain.com)

I would like to know if it is possible for me to catch all subdomains and point it to a generic subdomain on the same root domain while keeping my development subdomain.

BTW, I have access to SSH but not on the OS itself (It's a shared hosting)

Thanks in advanced.

Bobo Filipino

Posted 2016-10-07T09:07:41.383

Reputation: 11

Considering that this is shared host, will your hosting provider allow you to create subdomains with external software? – Burgi – 2016-10-10T19:32:04.330

no. it's does not. – Bobo Filipino – 2016-11-28T01:46:12.013

Then we cannot help you. – Burgi – 2016-11-28T08:45:50.123

Answers

0

As a client directly asks for a specific domain you'd just keep your dev domain on a DNS level. So even if you have a wildcard CNAME record a client looking for the dev domain would ask the DNS server for that specific domain and it should return the more specific one. This might depend on the arrangement in the zone file (I'm not entirely sure).

If you're worried just make it a sub-sub domain as an example johndoe.users.example.com or consider just setting up normal A records that point to your server. What's the reason you wouldn't want to do that? It would allow you to receive a HOST header which contains the user.

Seth

Posted 2016-10-07T09:07:41.383

Reputation: 7 657

So does that mean that a specific subdomain overrides the wildcard entry? – Bobo Filipino – 2016-10-07T09:47:56.067

It should, yes. It might depend on your DNS server software though. I'm not a hundred percent sure how e.g. bind parses the zone file so depending on that it might be important to have the more specific definition before the more generic one. – Seth – 2016-10-07T09:50:58.847

I tried your suggestion and created a for "generic" subdomain called dashboard (i.e. dashboard.mydomain.com) and creating a wildcard "*" CNAME pointing to that subdomain. Going directly to dashboard.mydomain.com displays the correct homepage but entering something like user1.mydomain.com displayed a welcome page from GoDaddy. I'm trying to locate that default welcome page from the files on the server but can't find it. – Bobo Filipino – 2016-10-07T10:10:27.417

So you did follow this setup? Mind the hint that it won't work with web hosting offers from GoDaddy. Oh and what's your actual objective? You might not be able to tell what the original request/user was this way.

– Seth – 2016-10-07T10:18:42.980

My goal is to give then their personal subdomain. I will extract their username from the subdomain name. – Bobo Filipino – 2016-10-07T10:21:34.373

About your answer, I think A record only allows me to point to an IP address, not subdomain. – Bobo Filipino – 2016-10-07T10:27:54.853

Yes but you can have a near infinite number of A records that point to the same address. You'll have to check your webserver configuration on whenever you're able to retrieve the name. – Seth – 2016-10-07T11:38:56.223