Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save vivirenremoto/a6a0afba60a4a1d9dc27120eff7a8733 to your computer and use it in GitHub Desktop.
Save vivirenremoto/a6a0afba60a4a1d9dc27120eff7a8733 to your computer and use it in GitHub Desktop.
fix redirects seo
if (isset($_GET['controller']) && $_GET['controller'] == 404) {
$t_url = explode('?', $_SERVER['REQUEST_URI']);
$redirect = current($t_url);
header('Location: ' . $redirect, true, 301);
exit();
} else if ($_SERVER['REQUEST_URI'] == '/best-sales??controller=404&p=2') {
$redirect = '/best-sales?p=2';
header('Location: ' . $redirect, true, 301);
exit();
} else if ($_SERVER['REQUEST_URI'] == '/best-sales??controller=404&p=143') {
$redirect = '/best-sales?p=143';
header('Location: ' . $redirect, true, 301);
exit();
} else if ($_SERVER['REQUEST_URI'] == '/87_power-dynamics?p=4?controller=404') {
$redirect = '/87_power-dynamics?p=4';
header('Location: ' . $redirect, true, 301);
exit();
} else if ($_SERVER['REQUEST_URI'] == '/hifi--_69?p=2?controller=404') {
$redirect = '/hifi--_69?p=2';
header('Location: ' . $redirect, true, 301);
exit();
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment