Skip to content

Instantly share code, notes, and snippets.

@marcus-at-localhost
Created March 18, 2014 19:30
Show Gist options
  • Save marcus-at-localhost/9627579 to your computer and use it in GitHub Desktop.
Save marcus-at-localhost/9627579 to your computer and use it in GitHub Desktop.
Joomla Language 303 redirect to better 301 redirect (/plugins/system/languagefilter/languagefilter.php)
// redirect if sef does not exists
// around line 226
if (!isset(self::$sefs[$sef]))
{
// Use the current language sef or the default one
$sef = isset(self::$lang_codes[$lang_code]) ? self::$lang_codes[$lang_code]->sef : self::$default_sef;
$uri->setPath($sef . '/' . $path);
if ($app->getCfg('sef_rewrite')) {
// append true for 301 redirect
$app->redirect($uri->base().$uri->toString(array('path', 'query', 'fragment')),'','',true);
}
else {
$path = $uri->toString(array('path', 'query', 'fragment'));
// append true for 301 redirect
$app->redirect($uri->base().'index.php'.($path ? ('/' . $path) : ''),'','',true);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment