Need advice on server settings. I am looking for solutions to the following tasks.

There is a server, say server.ru. You need to programmatically create (with emulate) a third-level domain (say, sub1.server.ru) without restarting the server. Then, you need to make all requests like:

sub1.server.ru/* 

Redirected to:

 sub1.server.ru/index.php?request=* 

I tried to solve both problems using the .htaccess file. But I could not solve the problem of changing the address bar in the browser. Those. when accessing sub1.server.ru, redirection to server.ru/subs/sub1 occurred, and this way was displayed in the address bar.

But if you solve the problem of creating virtual hosts by changing the apache settings, you must restart the server, which is unacceptable.



    2 answers 2

    Here, read automatic subdomains .

    • Thank. I will think =) ps How can you express gratitude? Someone even put a “teacher” to me, but I looked hard and did not find any check marks anywhere .. - Vitaly Kustov
    • @Vitaly Kustov If the answer is correct, you can accept it. If the answer, in your opinion, contains useful information, you can add a plus to it. - Nicolas Chabanovsky

    1 no need to restart, just apachectl reload or killall -HUP httpd

    2 lead URL sub1.server.ru/ to sub1.server.ru/index.php?request= can be using the system mod_rewrite

    read more: mod_rewrite