Skip to content

Magento 2 fastly GeoIP redirect to different store but same country based on domain

We have below website and store setup within a single Magento instance

Website 1 (domain1.com/uae)

  • Store A (Country Code: AE)

Website 2 (domain1.com/om)

  • Store B (Country Code: OM)

Website 3 (domain2.com/uae)

  • Store C (Country Code: AE)

Website 4 (domain2.com/om)

  • Store D (Country Code: OM)

Fastly Geo IP configuration as below

enter image description here

Expected result

  • Based on user IP and domain redirect to specific store of that country

    Scenario 1: Domain – domain2.com, User Country – OM

    • Redirect to domain2.com/om

    Scenario 2: Domain – domain1.com, User Country – OM

    • Redirect to domain1.com/om

    Scenario 3: Domain – domain2.com, User Country – Any

    • Redirect to domain2.com/ae

    Scenario 4: Domain – domain1.com, User Country – Any

    • Redirect to domain1.com/ae

Actual result

  • It is redirecting to first matching country store in fastly geoip configuration since they share the same country code

    Scenario 1: Domain – domain2.com, User Country – OM

    • Redirecting to domain1.com/om

    Scenario 2: Domain – domain1.com, User Country – OM

    • Redirecting to domain1.com/om

So any suggestions for proper redirection?