C
C
cCube2013-01-22 15:48:25
Apache HTTP Server
cCube, 2013-01-22 15:48:25

How to make the right redirect for a multilingual site

The question is the following.

There is a site that is available at several addresses (in the domains .rf, .ru, .co.za). The site has 2 languages, which are switched
by adding / en or / ru en There is a condition in .htaccess:


RewriteCond %{HTTP_HOST} ^www.site.co.za$
RewriteRule ^(.*)$ site.co.za/en/ $1 [R=301,L]


At the same time, if you add a similar RewriteCond for an address without WWW, then you get an infinite loop.

Please tell me how to organize such a redirect.

Answer the question

In order to leave comments, you need to log in

2 answer(s)
B
betal, 2013-01-22
@betal

Apparently it is necessary to compare not with HTTP_HOST in the second condition, but with
PATH_INFO
QUERY_STRING
REQUEST_URI
I can’t say for sure, I write such things in nginx

C
cCube, 2013-01-22
@cCube

The problem is this - after a redirect (external) to site.co.za/en is made, another redirect (internal) to site.co.za occurs and then the cycle continues. You can see what I mean by typing "ntgk" instead of "site" as the site name.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question