S
S
Sergey2017-06-20 10:24:48
symfony
Sergey, 2017-06-20 10:24:48

How to redirect from subdomains to the main domain?

Good day!
In general, I ran into a problem, apparently in the server configuration. When accessing non-existent subdomains, for example, 123.site1.ru/ or 54321.site.ru, the page of the site.ru website is returned.
How and where can I fix this moment?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
V
Viktor Taran, 2017-06-20
@shambler81

but it's not a good idea to place it in the /var/www folder
and the like.
Since you have a default.conf config in which all "garbage" requests
like dev zero for sites are collected.
As a rule, those who are particularly distinguished put the site in this folder. As a result, this site is available on any domain that refers to this site, any IP, and so on. . But in fact, it should contain "hello, you made a mistake with the site, but the server is the same"
But for real sites, their own configs are created with the prescribed paths to the files.
Then the Apache hits the http header to the desired site.
In your case, the site test.ru most likely lies in exactly such a place, as an option to create a separate virtual host for it and not work.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question