Good day.
Help me figure it out, or rather, point to the right thought.
I have all the content redirected from one domain to all subdomains, added the A record in general.
* .domen.ru --- sub.domen.ru
Thus, it turns out that my subdomains take the contents of the domain. Subdomains have different bases, and you need to do something to connect to the necessary database. Naturally, I did this through $_SERVER['SERVER_NAME'] , took the name of the subdomain, and explode separated it, checking the name of the subdomain and the name of the database. If it is identical, then made the connection.
Everything works, but one thing BUT. I want to further make it possible to change the subdomain to a domain. Everything rests on the fact that the name and addresses will be different, and how to connect to the database in this case ??? I thought to do something like separate config files for different subdomains where the name of the database will fit in, and by this configuration, connect to the required one, even if the database and the address are not identical to each other. But after all, I have all the contents of * .domen.ru --- sub.domain.ru, and naturally, everything that I put inside sub.domen.ru will not work, but will work only if it is in my domen.ru.
Help!