IP-Address based Country Redirect. The Extra uses the IP-API-Service of IPLocate to get the country-code of the user and redirects to the defined context.
So far 1,500 daily requests are free. If you need more request you can get yourself an API-Key at APILocate and set it in the System-Settings:
|ipcr.apikey||Optional API-Key. Get your Key at APILocate|
|ipcr.anonymizeip||false||Anonymize IP-Address (example: 203.0.113.195 -> 203.0.113.0)|
Now just define the country-codes in the context you want the user to be redirected to:
|ipcr.countries||County-Codes: Comma separatet list of county-codes that match this context. Example: de,at,ch|
Place the Snippet into the Root-Context of your site:
If you have 3 Context:
- web = Root-Context
- de = Germany
- us = USA
Place the Snippet
[[!ipCountryRedirect]] into your Root-Context (web) into your site_start.
Define all your country-codes in your contexts with the context-key
- de = de,at,ch
- us = us
Finished! Your user should be redirected to your defined contexts.
By default the user gets redirectet to your Default-Context (System-Setting:
If the Extra can't locate the user or the country is not defined in any context: The extra will redirect to your default context.
Make shure your Default-Context is not the same context as your Root-Context.