I
I
igorc752019-06-27 09:33:37
Domain Name System
igorc75, 2019-06-27 09:33:37

Virtual subdomain or physical?

Good afternoon!
For the site, you need to make several subdomains in order to cover several nearby cities.
Can you tell me how to implement this concept?

Answer the question

In order to leave comments, you need to log in

3 answer(s)
F
FanatPHP, 2019-06-27
@FanatPHP

This question was asked 100500 times, but too lazy to search.
A wildcard record *.example.com is made in the DNS so that all requests to subdomains lead to one host.
Apache is configured in the same way.
The specific host requested is taken from HTTP_HOST.
That's it, nothing more is needed.

D
Dim Boy, 2019-06-27
@twix007

For seo, it is better to do it virtually, with folders.

D
Dmitry Derepko, 2019-06-27
@xEpozZ

If this is a small site that will be absolutely identical in all cities, then you can simply access the main one from each subdomain and put down the city in the settings there.
If the site belongs to different legal entities/individuals and slightly deviates from its counterparts in the subdomain, then you can start a new application instance on the subdomain and give each site to the right hands.
If you already know how to write conditions and understand well how to resolve this or that conflict of views, then you can "internalize" the site. In terms of addressing the msk.site.ru subdomain, it will simply be a mirror to site.ru/?city=moscow. And the content and logic of site.ru will already depend on ?city=*

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question