Mobile app version of vmapp.org
Login or Join
Heady270

: Geolocalization and Redirection I have a multilanguage website. My project was to add the Geolocalization so base on the country that open the site to redirect in the specific url with the right

@Heady270

Posted in: #Apache2 #Geolocation #ModRewrite #UrlRewriting

I have a multilanguage website.
My project was to add the Geolocalization so base on the country that open the site to redirect in the specific url with the right language.
The structure of the website is
domainname (main domain)
it.domainname (subdomains for the languages)
de.domainname (subdomains for the languages)


All works fine but today i realize that i have the following problem.
When someone from Italy try to open the website will be redirect to it.domainname.
BUT if he wants to click in Flag of Emglish site(which is the domain) redirected again to the it.domainname. If wants to open any other language of the site it's not has a problem.

My rule in .htaccess is the following:

RewriteCond %{ENV:GEOIP_COUNTRY_CODE} ^IT$
RewriteRule ^(.*)$ it.domainanme.com/ [R=303,L]

10.01% popularity Vote Up Vote Down


Login to follow query

More posts by @Heady270

1 Comments

Sorted by latest first Latest Oldest Best

 

@Candy875

A solution is to implement the redirect using javascript on the user side rather than a rule on the server. You could also check for user settings saved on his/her device.

10% popularity Vote Up Vote Down


Back to top | Use Dark Theme