How to create a second-level domain name directly on the backend

Source: Internet
Author: User
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.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.