N
N
Nikolai Khokhlunov2016-03-31 13:06:33
linux
Nikolai Khokhlunov, 2016-03-31 13:06:33

How does the creation of subdomains by buttons work?

For example, there is a CRM written in php. It is necessary that everyone could get their CRM on a subdomain.
As I understand it: when registering on the site, the username.crm.ru subdomain is created, the username folder on the server in which CRM is installed and the database under this folder.
Do I understand the algorithm correctly?
What technologies can be used to launch it on the button?
What to do when there are 1000 such folders and subdomains?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
O
O. J, 2016-03-31
@nik0lazz

In order not to fence a bunch of databases for each subdomain, and folders with copies of the CRM backend, thereby once again loading the system. you can configure mod_rewrite in such a way that username.crm.ru is sent to site.ru/users/username, and this router is already processed by the framework.
More or less like this.

RewriteEngine On
RewriteCond %{HTTP_HOST} !^www\.site.ru
RewriteCond %{HTTP_HOST} ([^.]+)\.site.ru
RewriteRule ^(.*)$ /users/%1

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question