Answer the question
In order to leave comments, you need to log in
How to redirect the user to the site depending on his country?
Hello. I have two folders:en and ru . I need to redirect the user to an index file in one of these folders depending on their location. Tell me how to implement all this?
Answer the question
In order to leave comments, you need to log in
If necessary, depending on the country, you can use, for example, geoIP (or any other service), which by IP will tell you the most likely country.
In general, there are many solutions to the initial situation:
1) Use GeoIP to determine the source of the request
2) Check the Accept-Language header and redirect depending on the language (option from Alexander )
3) Redirect to /ru/ (or /en/) depending on whether who is the primary one and there already do a pop-up hint with a city change (like "Our site is in other languages")
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question