E
E
Ext72018-10-02 22:40:57
Internationalization and localization
Ext7, 2018-10-02 22:40:57

Htaccess redirects for a multilingual site?

Colleagues, please help. The task is to write a RewriteRule for a multilingual site, provided that the php gettext extension is used.
gettext physically uses the same page files - it's just that the translation for them is loaded automatically from the language files. Those. the site.com/about link will show either Russian, or English, or any other language, depending on the locale settings (which can already be changed depending on get, at least on cookies, at least somehow).
But I want to make the default language open by the link
• site.com/about
and in another language, for example, Russian by the link
• site.com/ru/about
Actually, the question is how to make the link
site.com/ru/about simultaneously served as a get-parameter for the ru-language, but at the same time opened the file from the site.com/about location, because there are no files in the site.com/ru/ directory, it simply does not exist.
I think this is solved through htacess, but if there is just using php, I will also be grateful for it.

Answer the question

In order to leave comments, you need to log in

1 answer(s)
E
Ext7, 2018-10-03
@Ext7

It seems I decided on my own, having peeped the information from several articles.
Added rules to .htaccess:
RewriteCond %{REQUEST_URI} !^/styles/(.*)$ (exception for styles folder)
RewriteCond %{REQUEST_URI} !^/img/(.*)$ (exception for images folder) RewriteRule ^(.*)/(.*)$ /$2?l=$1 [L] (actually, the rule: the /ru/faq page loads information from / faq while the url
remains the same in the browser) , errors will be revealed, but so far they have not been found.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question