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:
@
--->justjavac.com
www
--->www.justjavac.com
*
--->*.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.