PHP: multilingual site on subdomains without multiple copies of public_html

I have a multilingual (11 languages) site. Now it works, selects the language using the "language" get or cookie option. Now I want to use subdomains instead of cookies and get the parameter. But I do not want to make 11 full copies of the website (engine and some static things) for each subdomain. Is it possible to put some php and htaccess code (a very small part) in each root directory of subdomains, so only 11 copies of the site engine, etc. Will be used by 11 subdomains. Thank.

+5
source share
2 answers

I would say to configure Apache to point all your virtual hosts to the same folder, then use $ _ SERVER ["SERVER_NAME"] to find out which subdomain was being requested.

+3
source

you will have no choice but to select the selected language. I still like the idea of ​​aSeptik, but in my applications I prefer to use the accept-language http-header from the browser to determine the user's default language and use the session (so cookies or POST options again) to save a different language.

0
source

All Articles