Created
August 22, 2018 10:36
-
-
Save dawoe/7bf4ef7e60fe3fdbf65f1f35c712d4bc to your computer and use it in GitHub Desktop.
Redirect based on browser language
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<rule name="RedirectToDutchHomepage" enabled="true" stopProcessing="true"> | |
<match url="^$"></match> | |
<conditions> | |
<add input="{HTTP_ACCEPT_LANGUAGE}" pattern="^nl"></add> | |
</conditions> | |
<action type="Redirect" url="https://{HTTP_HOST}/nl/"></action> | |
</rule> | |
<rule name="RedirectToFrenchHomepage" enabled="true" stopProcessing="true"> | |
<match url="^$"></match> | |
<conditions> | |
<add input="{HTTP_ACCEPT_LANGUAGE}" pattern="^fr"></add> | |
</conditions> | |
<action type="Redirect" url="https://{HTTP_HOST}/fr/"></action> | |
</rule> | |
<rule name="RedirectToGermanHomepage" enabled="true" stopProcessing="true"> | |
<match url="^$"></match> | |
<conditions> | |
<add input="{HTTP_ACCEPT_LANGUAGE}" pattern="^de"></add> | |
</conditions> | |
<action type="Redirect" url="https://{HTTP_HOST}/de/"></action> | |
</rule> | |
<rule name="RedirectToEnglishHomepage" enabled="true" stopProcessing="true"> | |
<match url="^$"></match> | |
<action type="Redirect" url="https://{HTTP_HOST}/en/"></action> | |
</rule> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
This will redirect the user based on browser language.
If nl, fr or de is detected in the browser language it will be redirected to the homepage ofr that language
If not the user will be redirected to the english homepage