I recently wrote a personal resume display page. The page to display users is http://xxx.com/?+username. However, I saw that many websites can directly specify a second-level domain name in the background and then bind it. How to achieve this? of?
I recently wrote a personal resume display page. The page to display users is http://xxx.com/?+username. However, I saw that many websites can directly specify a second-level domain name in the background and then bind it. How to achieve this? of?
Some DNS service providers (such as the famous domestic DNSPod) have API interfaces, which can be called to add or delete subdomain names. However, it is more convenient to use pan-domain name resolution.
Pan-wide domain name resolution is to resolve all other domain names (without adding specific records) to one IP.
Then in httpd such as nginx, you can also use regular expressions or wildcards to map uncertain domain names to a site.
For example:
<code>server { listen 80; server_name *.example.com; root /path/to/root; }</code>
Then PHP can identify different domain names through $_SERVER['HTTP_HOST']
.