Multisite and multilingue wordpress website settings

Hi !

I’m trying to create a multisite and multilingual wordpress website.

I have configured the first website in multilingual with the settings file and the « subdirectory » params but when I create the other website, the url matches with the first website and doesn’t care what the « match » params are.

const settings = [
  //FIRST SITE FR
  {
    name: 'Frontity site 1 FR',
    match: ['https://wp-frontity.local/', 'http://localhost:3000/'],
    state: {
      frontity: {
        url: 'https://wp-frontity.local/',
        title: "Frontity FR",
        description: "Frontity description FR"
      }
    },
    packages: [
      {
        name: 'my-first-theme',
        state: {
          theme: {
            lang: 'fr',
            autoPrefetch: "hover",
          }
        }
      },
      {
        name: '@frontity/wp-source',
        state: {
          lang: 'fr',
          source: {
            url: "https://wp-frontity.local/",
            homepage: "accueil",
            postsPage: "articles",
            postTypes: [
              {
                type: "destinations",
                endpoint: "destinations",
                archive: "/destinations"
              }
            ],
            api: "https://wp-frontity.local/fr/wp-json",
          }
        }
      },
      "@frontity/tiny-router",
      "@frontity/html2react"
    ]
  }, 
  //FIRST SITE EN
  {
    name: 'Frontity site 1 EN',
    match: ['https://wp-frontity.local/en/', 'http://localhost:3000/en/'],
    state: {
      frontity: {
        url: 'https://wp-frontity.local/en/',
        title: "Frontity EN",
        description: "Frontity description EN"
      }
    },
    packages: [
      {
        name: 'my-first-theme',
        state: {
          theme: {
            lang:'en',
            autoPrefetch: "hover",
          }
        }
      },
      {
        name: '@frontity/wp-source',
        state: {
          lang: 'en',
          source: {
            url: "https://wp-frontity.local/en/",
            subdirectory: 'en',
            homepage: "home",
            postsPage: "articles",
            postTypes: [
              {
                type: "destinations",
                endpoint: "destinations",
                archive: "/destinations"
              }
            ],
            api: "https://wp-frontity.local/en/wp-json",
          }
        }
      },
      "@frontity/tiny-router",
      "@frontity/html2react"
    ]
  },
  //SECOND SITE FR
  {
    name: 'Frontity site 2',
    match: ['https://duplicate-one.local/'],
    state: {
      frontity: {
        url: 'https://duplicate-one.local/',
        title: "Frontity Site 2",
        description: "Frontity description Site 2"
      }
    },
    packages: [
      {
        name: 'my-first-theme',
        state: {
          theme: {
            lang:'fr',
            autoPrefetch: "hover",
          }
        }
      },
      {
        name: '@frontity/wp-source',
        state: {
          lang: 'fr',
          source: {
            url: "https://duplicate-one.local/",
            homepage: "accueil",
            postsPage: "articles",
            postTypes: [
              {
                type: "destinations",
                endpoint: "destinations",
                archive: "/destinations"
              }
            ],
            api: "https://duplicate-one.local/wp-json",
          }
        }
      },
      "@frontity/tiny-router",
      "@frontity/html2react"
    ]
  }
]

export default settings;

Thanks for your help

1 Like

try this for your first website :

match: ["http://localhost:3000(?!.*\\/en).*"]

should only match if there is anything but /en after localhost:3000

Hello !
Thanks for you answer.

But it didn’t resolve my problem. I think the error doesn’t come from the first site with the language redirection but from the second. When I browse the second website, I’m redirected to the first one. I don’t understand why the match param « https://duplicate-one.local » is not good.