B
B
blueberries20162018-11-21 17:29:45
Apache HTTP Server
blueberries2016, 2018-11-21 17:29:45

How to create virtual hosts in Apache for only one site?

You need to create a virtual host that will respond only to a specific subdomain and redirect all requests to it to the correct folder (/var/www/html/folder). But at the same time, all requests to other subdomains must bypass this rule and are usually directed to the site's root directory /var/www/html. I read about virtual hosts, but in all the examples 2 virtual hosts are created, one for the main site, and the other for the subdomain and, accordingly, 2 folders. But the site files are now in /var/www/html and they should stay there anyway. Is such a scheme possible? If yes, how to implement it? What file to edit?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
V
Viktor Taran, 2018-11-21
@shambler81

1. put a web panel in order to have plenty to choose from, does it make sense for you to write these hosts yourself?
2. all mana for two domains since there is a difference between the first and second, since the first is a trap for any domains, and the second is a specific domain.
There is no difference between a subdomain and an Apache domain.
These are completely different sites, so this config is suitable for both sub-domain and any other site.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question