Answer the question
In order to leave comments, you need to log in
Languages on site
How best to make a website ...
Subdomains
ru.site.com, en.site.com, fr.site.com
or
site.com/ru/
site.com/fr/
site.com/en/
If the latter, then how to do it right links inside php
Answer the question
In order to leave comments, you need to log in
The less nesting, the more search engines like the page, i.е. with the en.site.ru/ and site.ru/en/ options, the first one will be more priority, although a little more cumbersome in implementation.
… of course, $language must be assigned to each link. '/link/'; ...
I would replace the direct output of links with output through a "helper" in which you can already process the link as you need, including adding the language prefix.
if the site is informational, a subdomain is better.
if something like a social network or a blog will be translated only by the interface, it is better to switch to other languages with passing a parameter as part of the url or a whistle.
we define the language like this - look at the address parameters, if not - look at the cookie, if not - look at the account data, if not - look at $_SERVER['HTTP_ACCEPT_LANGUAGE'] and compare with the list of our languages, if there are no matches - issue default.
if the language is in %lang%.domain.ru, then domain.ru is defined as the absence of the specified language and we follow the steps described above, after which we redirect to the corresponding subdomain.
What is the site on? Some kind of framework? Engine? What? From scratch?
It seems to me that the first one looks neater, but the disadvantages of this solution are: configuring Apache for name-based hosting, you need access to DNS, a long update of the site.com DNS zone.
The second is easier to implement (there is no time spent on updating DNS). Links can be made relative (as in PHP - I don’t know).
All language versions are located on the site.com domain, and the user's current language is taken from cookies, where it is entered either from the browser's preferred language, or by the user's conscious choice.
The user's choice is the links site.com/fr/, site.com/en/, etc. whose handler just sets a cookie and redirects either to the referrer (if it is within your site) or to the main page of your site. Accordingly, all inscriptions on the site are displayed special. a function whose argument is a label - a short but understandable description of the string behind it, for example T('PLEASE_LOGIN') displays the inscription "Please register" in the desired language, all labels and their translations into all languages are stored in one place.
Does this option not work for you?
the domain of the site must be one site.com, see the implementation of apple.com or ibm.com
I would choose en.site.com for the reason that the subdomain can be another site with a different structure and even themes. Moreover, for certain queries, several subdomains can enter the top at once.
For SEO also, IMHO, subdomains are better. The only question is that it is not always possible to manage a site on subdomains from a single admin panel.
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question