I would like a user from different country to be redirected to a set directory in Laravel.
I have tried this URL redirecting base on information seen here, using:
RewriteCond %{ENV:IP2LOCATION_COUNTRY_SHORT} ^DE$
RewriteRule ^(.*)$ http://example.com/germany [L]
Now it not working. Please how can I work it out?
Step #1 - Get IP Address
Step one is easy enough
Actually, this may not be the most accurate method. But this is covered in more detail in this thread
Step #2 - Get Region from IP
The only way to associate an IP with a region, is to use a third-party service. For example, ipinfo.io.
Step #3 - Redirect Page
Finally, you can then redirect the user using the above result.