Recently I wrote a personal resume display page. the user's page is xxx.com? + Username, but I have seen that many websites can directly specify a second-level domain name in the background and then bind it. how can this problem be achieved? Recently I wrote a personal resume display page, show the user page is http://xxx.com /? + Username, but I have seen that many websites can directly specify a second-level domain name in the background and then bind it. how can this problem be achieved?
Reply content:
Recently I wrote a personal resume display page, show the user page is http://xxx.com /? + Username, but I have seen that many websites can directly specify a second-level domain name in the background and then bind it. how can this problem be achieved?
Some DNS service providers (such as the well-known DNSPod in China) have Apis. you can call these APIs to add or delete subdomains. However, wildcard domain name resolution is more convenient.
Wildcard domain name resolution is to resolve all other domain names (no specific records are added) to an IP address.
Then, you can use regular expressions or wildcards in httpd such as nginx to map uncertain domain names to a site.
For example:
Server {listen 80; server_name * .example.com; root/path/to/root ;}
PHP then passes$ _ SERVER ['http _ host']
To identify different domain names.