HEX
Server: Microsoft-IIS/8.5
System: Windows NT YDAWBH120 6.3 build 9600 (Windows Server 2012 R2 Standard Edition) AMD64
User: tentjecom_web (0)
PHP: 7.4.14
Disabled: NONE
Upload Files
File: D:/HostingSpaces/SBogers10/spire.komma-mediadesign.nl/wwwroot/lib/x2_old_links.php
<?php

/**
 * 1. Get the REQUEST_URI and explode this on '/'
 */
$stringUrl = substr($_SERVER['REQUEST_URI'],1);
$urls = explode('/', $stringUrl);

$x2Page = '';
$x2Sub = '';
$x2Sub2 = '';

// Get pages
if(isset($urls[0]) && ! empty($urls[0]))
{
    $x2Page = strtolower($urls[0]);
    if(isset($urls[1]) && ! empty($urls[1]))
    {
        $x2Sub = strtolower($urls[1]);
        if(isset($urls[2]) && ! empty($urls[2]))
        {
            $x2Sub2 = strtolower($urls[2]);
        }
    }
}

$found = true;
if( ! empty($x2Page))
{
    switch($x2Page)
    {
        case 'about-us':
            $url = 'company';
            break;
        case 'product-groups':
        case 'peripherals':
        case 'cases':
        case 'cooling':
        case 'psu':
            if ( ! empty($x2Sub))
            {
                $url = '';
                switch($x2Sub)
                {
                    case 'x2-6011b-ce-r':
                        $url .= 'computer-cases/x26011-mod-series-x2-6011b-ce-r';
                        break;
                    case 'x2-6017':
                        $url .= 'computer-cases/x26017-silent-series-x2-6017';
                        break;
                    case 'x2-6018b-cer':
                        $url .= 'computer-cases/x26018-mod-series-x2-6018b-ce-r';
                        break;
                    case 'x2-6019b-ce-r':
                        $url .= 'computer-cases/x26019-mod-series-x2-6019b-ce-r';
                        break;
                    case 'x2-m705b-120w-eu':
                        $url .= 'computer-cases/quantax-x2-m705b-200w-eu';
                        break;
                    case 'x2-12025n7l3':
                        $url .= 'system-cooling/x2120n-x2-12025n7l3';
                        break;
                    case 'x2-12025n7l4-b-pwm':
                        $url .= 'system-cooling/x2120n-bld-x2-12025n7l4-b-pwm';
                        break;
                    case 'x2-9862n1-pwm':
                        $url .= 'cpu-coolers/eclipse-iv-x2-9862n1-pwm';
                        break;
                    case 'x2-mp02':
                        $url .= 'pc-accessories/xpad-x2-mp02';
                        break;
                    case 'x2-mp03':
                        $url .= 'pc-accessories/xpad-pro-xxxl-x2-mp03';
                        break;
                    case 'x2-hs7006':
                        $url .= 'pc-accessories/aurel-x2-hs7006';
                        break;
                    case 'x2-hs7501-usb':
                        $url .= 'pc-accessories/mars-x2-hs7501-usb';
                        break;
                    case 'x2-hs7502-usb':
                        $url .= 'pc-accessories/mars-x2-hs7501-usb';
                        break;
                    case 'x2-hs7601-usb':
                        $url .= 'pc-accessories/saturn-x2-hs7601-usb';
                        break;
                    case 'x2-m3001-usb':
                        // not found
                        $found = false;
                        break;
                    case 'x2-r-650wdb-apfc':
                        $url .= 'power-supplies/chronosphere-x2-r-650wdb-apfc';
                        break;
                    default:
                        $found = false;
                }
                if ( ! empty($x2Sub2) && $found)
                {
                    switch($x2Sub2)
                    {
                        case 'specifications':
                            $url .= '/specs';
                            break;
                        case 'downloads':
                            $url .= '/downloads';
                            break;
                    }
                }
            }
            else
            {
                $url = 'products';
            }
            break;
        case 'awards':
            $url = 'media/awards';
            break;
        case 'terms-of-services':
            $url = 'terms-and-conditions';
            break;
    }
}

if( isset($url) && ! empty($url))
{
    header ('HTTP/1.1 301 Moved Permanently');
    header("Location: /" . $url );
    exit;
}
else if ( ! $found)
{
    header("HTTP/1.0 404 Not Found");
    header('location: /404');
    exit;
}