How do users like Diandian and Sina Blog submit their own second-level domain names and automatically resolve them?

Source: Internet
Author: User
Tags subdomain
I want to use wordpress to implement a lightweight blog function (not wpmu), but I don't know how to handle the second-level domain name, I want to know how a user submits second-level domain names and automatically resolves them like Diandian or Sina Blog? I want to use wordpress to implement a lightweight blog function (not wp mu), but I don't know how to handle the second-level domain name, I want to know how a user submits second-level domain names and automatically resolves them like Diandian or Sina Blog?

Reply content:

I want to use wordpress to implement a lightweight blog function (not wp mu), but I don't know how to handle the second-level domain name, I want to know how a user submits second-level domain names and automatically resolves them like Diandian or Sina Blog?

A record for domain name resolution:

  1. @--->justjavac.com
  2. www--->www.justjavac.com
  3. *--->*.justjavac.com

Method 3 can be implemented, and PHP can process the data on the web end without DNS-related programming.

After reading this question for a long time, the proxy server (nginx and apache) can forward it. For example, if you are wang.sina.com, you can directly convert it to www.sina.com/wang.

Wildcard domain name resolution

Pan resolution
* .Yuming.com
Determine this *.

Method 1

  • Through wildcard domain name resolution, all subdomain names under a top-level domain name are directed to an IP address, and then distinguished by the virtual host of the HTTP server.
Method 2
  • Create a DNS server and add an NS record for the top-level domain name to direct it to the DNS server. In this way, all the subdomain names are resolved by the server you have created.

On the same floor, generally DNS resolution service providers (such as DNSPOD) Support wildcard domain name resolution. You can add resolution similar to * .abc.com.

Then you can determine the site to which the request is sent based on the domain name in your server's http service (such as nginx ).

Or in your website program, you can use the host to determine which domain name the user accesses and then display different contents.

It is generally resolved through wildcard domain names, and now many service providers support it!

Wildcard parsing + pseudo-static can be done

What do you answer when someone asks about automatic resolution?

I think we can do a wildcard resolution, convert it to a specific URL, use a regular expression to get the user name, and use htaccess to perform redirection or rewriting.

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.