Multi Domains

Create multiple domains or url and bind this to arbitry theme or page/staticpage with extending routing rules use single CMS installation (support backend)

Back to Multi Domains Support

ramiskh
ramiskh

Здравствуйте. Помоги пожалуйста с настройками. У меня есть 3 домена:

Мне необходимо настроить 4 языка:

Для мультиязычности я буду использовать RainLab.Translate

Linkonoid
Linkonoid

Hi!

At what stage did you have difficulty setting up? If I understand correctly, then you have one Theme for all sites and they are different only in translation? You need to do these steps:

1) Create entry points for each domain in the binding table in accordance with your list and register ALL_PAGES and one Theme for all binds

2) In the main settings of the plugin, register a table of correspondence .TLD domain to the language

3) Select the appropriate language in the bindings for each entry point

With a high probability there will be problems with the localization of the domain https://site.com/de (it will be defined as "en", you can try in the settings to rigidly specify the language for this particular binding, not from the .TLD domain-language table). In any case, I need to reproduce your situation on the test server, if this does not work out of the box, let me know of your result

Last updated

ramiskh
ramiskh

Основные настройки

Привязки доменов:

RainLab.Translate:

Основной шаблон:

С этими настройками работает только английская версия. Переключение языков не работает.

Last updated

Linkonoid
Linkonoid

You have added the Rainlab.Translate component to layout?

ramiskh
ramiskh

Linkonoid said:

You have added the Rainlab.Translate component to layout?

Нет, Rainlab.Translate подключен на странице

ramiskh
ramiskh

Вроде разобрался немного, но возникла проблема с доменом https://site.com.ua TLD подставляет https://site.com.ru, а должен https://site.ru

Linkonoid
Linkonoid

Unfortunately, the plugin does not include TLD processing of the format .tld.tld (used default domain), try specifying .ua instead of .com.ua (and preferably set AUTO domain.xxx in the bindings). Please report the result.

I have further plans to improve the translation mechanism in the plugin (not everything is perfect)

Last updated

ramiskh
ramiskh

Я временно решил задачу так:

function onInit()
{
    $host = Request::getHost();

    $translator = class_exists('\RainLab\Translate\Classes\Translator') ? \RainLab\Translate\Classes\Translator::instance() : null;

    if (!is_null($translator) && !empty($host))

    switch ($host) {
        case 'site.com.ua':
            $translator->setLocale('uk',true);
            break;

        case 'site.ru':
            $translator->setLocale('ru',true);
            break;

        case 'de.site.eu':
            $translator->setLocale('de',true);
            break;

        default:
            $translator->setLocale('en',true);
    }
}

function onSwitchLocale()
{
    switch (input('locale')) {
        case 'uk':
            return Redirect::to('https://site.com.ua');
        case 'ru':
            return Redirect::to('https://site.ru');
        case 'de':
            return Redirect::to('https://de.site.eu');
        default:
            return Redirect::to('https://site.eu');
    }
}

Осталась проблема с переключением языков. Неправильно отрабатывает редирект https://site.ru/test -> EN -> https://site.eu

Last updated

Linkonoid
Linkonoid

This variant translation switching was used in the first plugin implementations (in the latest versions, everything is into the plugin code integrate). Your problem is related to the heterogeneity of domains, as I wrote above. I’ll think about how to solve it without adding additional code to the page layout. Ideally, everything should work through the table of settings of correspondence of domains to certain languages ​​in the AUTO mode in settings for binds.There will be an additional item in the settings to indicate the position number of the language layout pointer in the domain name (for de.domain.com - number 2 and "de", etc., to get away from the rigid construction of substitutions of the form xxx.domain.tld or domain.xxx). And the item will be added to automatically detect the locale from the user's browser data.

As for the switching problem, try different combinations of settings (auto or hard or, possibly, turning off broadcasting inside a certain bind altogether).

Last updated

ramiskh
ramiskh

Прошу прощения за мой долгий ответ. Я пробовал разные комбинации настроек, в итоге ни к чему не пришел. Я могу предоставить Вам доступы к сайту., чтобы Вы посмотрели что с моими настройками. Напишите пожалуйста, куда Вам их выслать?

Linkonoid
Linkonoid

I think that access will be redundant, because as I wrote above, you have a complicated domains configuration, a fundamental modification of the plugin is required (see post above). I will try to update the plugin in the coming days.

ramiskh
ramiskh

Linkonoid said:

I think that access will be redundant, because as I wrote above, you have a complicated domains configuration, a fundamental modification of the plugin is required (see post above). I will try to update the plugin in the coming days.

Благодарю. Жду с нетерпением

ramiskh
ramiskh

Linkonoid said:

I think that access will be redundant, because as I wrote above, you have a complicated domains configuration, a fundamental modification of the plugin is required (see post above). I will try to update the plugin in the coming days.

Вы еще не модифицировали плагин?

Linkonoid
Linkonoid

I apologize for the long answer (no have time), I code modified plugin only today because of another appeal (and the same time I decided to close your question).

Plugin update v1.4.5: The translation mechanism has been improved, now instead of the suffix and prefix, a specific position in the domain name is indicated (Added locale position in domain name).

What is done:

  • Added a field indicating the position in the domain name, i.e. xx.domain.ru (2-nd position, report from 0), now works in all modes
  • Added option to determine the current locale from the client browser
  • The hard set locale began to work correctly

Last updated

ramiskh
ramiskh

Здравствуйте. Спасибо за обновление. Сейчас я столкнулся с проблемой при использовании плагина.

  1. Нет возможности привязать домен. Ошибка:

  2. В консоли ошибка при попытке очистить кэш и др.

ramiskh
ramiskh

Если отключить плагин, то ошибки пропадают.

Linkonoid
Linkonoid

Thanks for the information, apparently this is the same as here: https://octobercms.com/plugin/support/linkonoid-mdomains/i-cant-save-general-link-settings-2. What is your database? Everything works without problems on Sqlite, now I will try to test on a new installation in October (most likely the problem is in the Mysql version). I will try to solve this problem in another way (apparently the update to 1.4.4 did not help).

Linkonoid
Linkonoid

I found bug in installation v1.4.5 (update v1.4.4 includes in v1.4.5 package) - bug fix in update v1.4.6

All tested on MariaDB v10.0.21 (Windows) and Sqlite (Debian) - works fine ...

Last updated

ramiskh
ramiskh

Linkonoid said:

I found bug in installation v1.4.5 (update v1.4.4 includes in v1.4.5 package) - bug fix in update v1.4.6

All tested on MariaDB v10.0.21 (Windows) and Sqlite (Debian) - works fine ...

Да, у меня используется база данных MySQL После обновлений ошибка осталась

Last updated

ramiskh
ramiskh

Я попробовал отключить проект и подключить его заново. Во время загрузки плагина выходит такая ошибка

1-20 of 22