J
J
Jewel0072015-11-26 16:18:05
PHP
Jewel007, 2015-11-26 16:18:05

How to "remember" the selected city on a site with cities on subdomains?

How to remember the choice of the city on the site, given that the cities are implemented as subdomains.
The task is to make regional subdomains for the site for seo site promotion in different cities according to geo-dependent queries.
At the moment, I have made robots and sitemap dynamically unique for each subdomain. Implemented city entry tokens so that for each city on its subdomain, a mention of the relevant city is displayed. Made a city selection menu.
I registered the *.domain.ru subdomain in the domain aliases, now when you specify a non-existent subdomain, for example spb.domain.ru, the contents of the domain.ru page with the mention of Peter are opened, that is, everything is fine. Same with the rest of the pages and cities.
BUT. I don’t know how to implement remembering the selected city, so that when you go from the spb.domain.ru page to the internal one, for example, to the /catalog section, stay within the selected subdomain, i.e. so that the address bar of the browser shows spb.domain.ru/catalog, and not domain.ru/catalog Tell me
in which direction to think. Cookies, .htaccess or something else. If possible with examples.

Answer the question

In order to leave comments, you need to log in

4 answer(s)
S
sunrails, 2015-11-26
@sunrails

Build URL based on current domain/subdomain. Cookies and everything else is useless here.

P
prodavec macdonalds, 2015-11-26
@prodavecmacdonalds

assign to subdomain -> create url from subdomain+url

D
DimanGr, 2015-12-16
@DimanGr

Sorry, but what about sessions?

E
eoobot, 2016-10-16
@eoobot

I solved this problem with wordpress multinet!

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question