#
#
# artur #2014-12-04 08:56:43
PHP
# artur #, 2014-12-04 08:56:43

How to bind a domain to a dynamic subdomain?

Hello!
We are writing a small diary service. Each user is given a space to maintain a "diary" and a dynamic subdomain of the form username.site.ru
I would like to implement the function of "connecting" a first-level domain of the form username.ru
How to organize this kind of binding? How is it generally done. Seen on different sites but never contacted.

Answer the question

In order to leave comments, you need to log in

4 answer(s)
F
FanatPHP, 2014-12-04
@passshift

Actually, there is no binding to subdomains here.
And there is a regular domain plus in the admin panel a stupid sign like domain => username, which replaces getting a username from a subdomain

R
Ruslan, 2014-12-04
@Razbezhkin

First, you need to organize the DNS setting on which the domain zone is located so that there is an A or CNAME record that will refer to the web server address. If this name is username.mydomain.ru, then it’s easier: we find DNS hosting that has an API for editing zones and edit the mydomain.ru zone by adding a username entry to it. If this is a user's domain, such as username.ru, then you will have to force the user to edit his own zone.
Secondly, on the web server, we configure the binding of the web server to the ip address without binding to the domain, so that it processes all requests on port 80.
Implementation details depend on the technologies you are using and on the hosting api dns.

N
Nazar Mokrinsky, 2014-12-04
@nazarpc

At what here PHP???

N
nikitasius, 2014-12-04
@nikitasius

Read the article .

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question