Hi,
For a multilanguage site I want to implement an automatic language attribution in the default controller. But I wonder whether my solution using the URL helper function redirect() will not perturb Google referencing the pages. I’ve already had bad
experiences using redirects (that was a HTML refresh, though).
My solution
class Front extends Controller{
function index()
{
$langs = $this->agent->languages();
// the critical part of it
redirect($langs[0]);
}
}
class En extends Controller {
function _remap()
{
$lang = 'en';
$data['menu'] = $this->_menu($lang);
$this->load->view($this->html_template, $data);
}
}
class Fr extends Controller {
function _remap()
{
$lang = 'fr';
$data['menu'] = $this->_menu($lang);
$this->load->view($this->html_template, $data);
}
}The above gives me :
1. no routing required
2. I obtain short URLs http://www.site.com/fr/content, www.site.com/en/content
3. I need the language detection only in the front controller
4. Google has a 1:1 relation for address and content
Do You think that my solution will work out for the referencement?
Is there a risk that Google or any other motor will reject my site due to the redirect?
Do You have a better solution 😉