K
K
Kirill Firsov2010-11-09 13:01:24
PHP
Kirill Firsov, 2010-11-09 13:01:24

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

10 answer(s)
S
slang, 2010-11-09
@Isis

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.

D
Dmitry404, 2010-11-09
@Dmitry404

… 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.

R
Rodion Gashé, 2010-11-09
@zorba_buddha

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.

M
MyraJKee, 2010-11-09
@MyraJKee

What is the site on? Some kind of framework? Engine? What? From scratch?

X
XRay39, 2010-11-09
@XRay39

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).

C
Cheese, 2010-11-09
@Cheese

what's the problem with php links? it supports relative paths

D
Dmitry Dedukhin, 2010-11-09
@Demetros

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?

D
dfpoint, 2010-11-09
@dfpoint

the domain of the site must be one site.com, see the implementation of apple.com or ibm.com

B
Boris Manzhela, 2010-11-09
@EKCTPEMICT

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.

P
porohnya, 2010-11-09
@porohnya

Take a framework like Zend, both options are very easy to implement there. Don't Forget About Cross-Domain Authentication

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question