M
M
Maxim2014-02-23 22:38:58
Apache HTTP Server
Maxim, 2014-02-23 22:38:58

How to create dynamic subdomains?

Interested in how to create dynamic subdomains on the apache server, for example, for user accounts, for example: username.website.ru
Look towards the rules in .htaccess? Then this is apparently some kind of get parameter, for example, which one from website.ru/index.php?u=username rewrites to username.website.ru - it would not be bad.
I am also interested in the question of the environment, will the standard environment that is on virtual hosting be enough?

Answer the question

In order to leave comments, you need to log in

2 answer(s)
F
FanatPHP, 2014-02-24
@FanatPHP

Surprising fact from the animal world:
For some very strange reason, hamsters cannot live without .htaccess
Without using this web server configuration file, the application seems to them unsolid, incomplete. And they try to shove it wherever they can.
Although it would be worth stopping for a minute and just thinking - is he needed here at all? What problem are we going to solve with it? Does it exist at all - is this a problem?
1) Add a wildcard (*.example.com) in your domain DNS settings so that any subdomain goes to the main one
2) In the web server settings, set the virtualhost * so that all requests are processed by the same virtualhost.
3) EVERYTHING. Do not need anything else. Everything is ready and working.

D
Dmitry Tallmange, 2014-02-24
@p00h

1) Add a wildcard (*.example.com) in your domain DNS settings so that any subdomain goes to the main one
2) In .htaccess add the rule subd.example.com => example.com/index.php?section=subd
3) On this will work for most hosts.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question