Skip to content

Instantly share code, notes, and snippets.

@AydinHassan
Last active August 29, 2015 13:56
Show Gist options
  • Save AydinHassan/9110876 to your computer and use it in GitHub Desktop.
Save AydinHassan/9110876 to your computer and use it in GitHub Desktop.
<?php
require_once __DIR__ . '/app/code/local/Nivea/Mobile/Model/Device/Detect.php';
$mobile = new Nivea_Mobile_Model_Device_Detect();
$isMobile = $mobile->isMobile();
$currentUrl = $env = ($_SERVER['HTTP_HOST']) ? $_SERVER['HTTP_HOST'] : $_SERVER['SERVER_NAME'];
$scheme = isset($_SERVER['HTTPS']) ? 'https://' : 'http://';
if ($isMobile && $currentUrl == 'shop.nivea.co.uk') {
$url = $scheme . "mobileshop.nivea.co.uk";
header("Location: $url");
exit;
}
if(!$isMobile && $currentUrl === 'mobileshop.nivea.co.uk') {
$url = $scheme . "shop.nivea.co.uk";
header("Location: $url");
exit;
}
require_once __DIR__ . '/index.php';
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment