user1267570
user1267570

Reputation: 211

PHP: multilingual website on subdomains w/o many copies of public_html

I have a multilingual (11 languages) website. Right now it works chooses language using 'language' get parameter or a cookie. Now I want to use subdomains instead of cookies and get parameter. But I do not want to make 11 complete copies of website (engine and some static stuff) for each subdomain. Is it possible to place some php and htaccess code (a very little piece) into each subdomain's root catalog, so only one copy of website's engine and stuff will be used by 11 subdomains. Thanks.

Upvotes: 5

Views: 423

Answers (2)

Lars
Lars

Reputation: 5799

you will not have much choice than to determine the chosen language somehow. I like aSeptik's idea best so far, but in my applications, I rather use the accept-language http-header from the browser to determine the default language of the user and use a session (so cookies or POST-Parameters again) to save a different language choice.

Upvotes: 0

Aerik
Aerik

Reputation: 2317

I'd say to configure your Apache to point all your virtual hosts to the same folder, then use $_SERVER["SERVER_NAME"] to figure out what subdomain was requested.

Upvotes: 3

Related Questions