重定向类不在共享主机上工作

I was following OOP Login System, php video tutorials from Codecourse. In the video series they have taught to create a Redirect class (Redirect.php):

<?php
class Redirect {
    public static function to($location = null) {
        if($location) {
            if(is_numeric($location)) {
                switch($location) {
                    case 404:
                        header('HTTP/1.0 404 Not Found');
                        include 'includes/errors/404.php';
                        break;
                }
            }
            header('Location: '. $location);
            exit();
        }
    }
}

Now I'm using the above class in a php file as

<?php
require_once 'Redirect.php';
    Redirect::to('index.php');
?>

The code works fine on localhost (WAMP Server) but it's not working on godaddy hosting. How to get rid of this problem ? Do I need to make any changes in Redirect class ?

Please help.