PHP - Redirect based on OS optimization
Before anything, I'll let you search on the web why this might not be such a good idea and I'll just focus on the code.


You probably should retrieve $_SERVER['HTTP_USER_AGENT'] and store it in a variable in order to avoid repeated code. Also, you might want to check if the variable is set properly before accessing it to avoid warnings/errors.
You can rewrite if ($variable == true) as if ($variable)
You could avoid the boilerplate and repeated code if you were storing the interesting parts of your logic in an array and write the common parts only once :



    $ua = isset($_SERVER['HTTP_USER_AGENT']) ? $_SERVER['HTTP_USER_AGENT'] : '';
    $redir = array(
        "Android" => 'android',
        "BB10"    => 'blackberry',
        "iOS"     => 'ios',
        "Windows" => 'windows',
        "Mac"     => 'mac'
    );
    if (isset($redir[$ua]))
    {
        header('Location: http://www.example.com/' . $redir[$ua]);
    }


I hope this helps!