<p>Here is what i have done. Not sure if it helps you. I can't add comments. So here you go. This is based on <a href="https://github.com/lukeholder/craft-geo" rel="noreferrer">geo</a> plugin</p>

<p>Plugin serviceclass:</p>

<pre>
<code>
//to get local ele
private function getLocalElement()
    {
        $source=craft()->request->getRequestUri();
         if($source==''){
             $source = 'home';
         }
        return  craft()->elements->getElementByUri($source);
    }

//finds locale and redirect
private function redirectToLang()
   {
       $value=$this->detectBrowserLang()."_".strtolower($this->detectCountryCode());
       if(in_array($value, craft()->i18n->siteLocaleIds)==1){
            $element=$this->getLocalElement();
            if(!is_null($element)){
                $localElementUri = craft()->elements->getElementUriForLocale($element->id, $value);
                header('Location: '.$this->configBaseUrl().'/'.$value.'/'.$localElementUri, true, 302); 
            }            
        }      

   }

//browser lang
private function detectBrowserLang()
   {
        $browserLang=craft()->request->getBrowserLanguages();
        if(isset($browserLang)){
            $lang=substr(strtolower($browserLang[0]),0,2); 
            return $lang;
        }
   }

//detect country code by geo
private function detectCountryCode()
    {
        $info=$this->getInfoGeo();
        $countryCode=strtoupper($info["country_code"]);      
        return $countryCode;          
    }

</code>
</pre>

<p>Basically checking browser lang and country code(geo) with craft locales.</p>

CC BY-SA 3.0
2015-06-03T18:28:04.467Z
2015-06-03T18:34:46.030Z
2015-06-03T18:34:46.030Z
lokesh
<p>I recently released Country Redirect, a plugin that handles this smoothly: <a href="https://superbig.co/plugins/country-redirect" rel="nofollow noreferrer">https://superbig.co/plugins/country-redirect</a></p>

<p>It lets you map which countries get redirected to which locales, let visitors override the country, and easily let you create a locale nav based on the country mapping.</p>

CC BY-SA 3.0
2017-04-26T19:21:37.903Z
2017-04-26T19:21:37.903Z
Fred Carlsen
<p>How would you <strong>redirect users</strong> with an "english browser" <strong>automatically</strong> to the english site? I have no idea if this can be made with craft or if this is an apache webserver thing. Any idea? </p>

<pre><code>'domain.de' =&gt; array(
    'siteUrl' =&gt; array(
        'de' =&gt; 'http://domain.de/',
        'en' =&gt; 'http://domain.de/en/',
    ),
), 
</code></pre>

CC BY-SA 3.0
2015-04-23T13:39:47.050Z
Hey Patte, you should probably find an answer to your question here: [Locale change based on geolocation](http://craftcms.stackexchange.com/questions/1022/locale-change-based-on-geolocation).
carlcs
CC BY-SA 3.0
2015-04-23T13:58:30.197Z
Hey carls, meanwhile I have successfully tested this solution: 302 redirects to locales in main index.php 
http://craftcms.stackexchange.com/questions/2108/302-redirects-to-locales-in-main-index-php

I have no chance to install an apache module so I hope this solves my client needs.
Patte
CC BY-SA 3.0
2015-04-23T18:15:50.493Z
Hi Patte... If that solution works for you, feel free to add it as an official answer (it's ok to answer your own question), and even mark the answer as "accepted".
Lindsey D
<redirect><language>
Localized Site -> howto redirect Browser
# Localized Site -> howto redirect Browser

(Asked by: username_0 on 2015-04-23)

How would you redirect users with an "english browser" automatically to the english site? I have no idea if this can be made with craft or if this is an apache webserver thing. Any idea? 
'domain.de' => array(
    'siteUrl' => array(
        'de' => 'http://domain.de/',
        'en' => 'http://domain.de/en/',
    ),
),

**Tags:** redirect, language

> **Comments:**
> **username_1**: Hey username_0, you should probably find an answer to your question here: [Locale change based on geolocation](http://craftcms.stackexchange.com/questions/1022/locale-change-based-on-geolocation).  
> **username_0**: Hey carls, meanwhile I have successfully tested this solution: 302 redirects to locales in main index.php  http://craftcms.stackexchange.com/questions/2108/302-redirects-to-locales-in-main-index-php  I have no chance to install an apache module so I hope this solves my client needs.  
> **username_2**: Hi username_0... If that solution works for you, feel free to add it as an official answer (it's ok to answer your own question), and even mark the answer as "accepted".  

---

## 2 answers

### Answer by username_3 on 2015-06-03. Score: 5

Here is what i have done. Not sure if it helps you. I can't add comments. So here you go. This is based on geo plugin
Plugin serviceclass:


//to get local ele
private function getLocalElement()
    {
        $source=craft()->request->getRequestUri();
         if($source==''){
             $source = 'home';
         }
        return  craft()->elements->getElementByUri($source);
    }

//finds locale and redirect
private function redirectToLang()
   {
       $value=$this->detectBrowserLang()."_".strtolower($this->detectCountryCode());
       if(in_array($value, craft()->i18n->siteLocaleIds)==1){
            $element=$this->getLocalElement();
            if(!is_null($element)){
                $localElementUri = craft()->elements->getElementUriForLocale($element->id, $value);
                header('Location: '.$this->configBaseUrl().'/'.$value.'/'.$localElementUri, true, 302); 
            }            
        }      

   }

//browser lang
private function detectBrowserLang()
   {
        $browserLang=craft()->request->getBrowserLanguages();
        if(isset($browserLang)){
            $lang=substr(strtolower($browserLang[0]),0,2); 
            return $lang;
        }
   }

//detect country code by geo
private function detectCountryCode()
    {
        $info=$this->getInfoGeo();
        $countryCode=strtoupper($info["country_code"]);      
        return $countryCode;          
    }



Basically checking browser lang and country code(geo) with craft locales.


---

### Answer by username_4 on 2017-04-26. Score: 2

I recently released Country Redirect, a plugin that handles this smoothly: <https://superbig.co/plugins/country-redirect>

It lets you map which countries get redirected to which locales, let visitors override the country, and easily let you create a locale nav based on the country mapping.


---

