php在特定的地方执行包含

I made a router using dynamic includes and I'm trying to "print" the include() in a page that is included in index.php (where the router is).

index.php

require_once('includes/functions.php');

sec_session_start();

$views                      = 'views/';
$site                       = $views . 'site/';
$user                       = $views . 'user/';
$admin                      = $views . 'admin/';

// whitelist
$includes = array(
    '/home'                 => $views . 'home.php',
    '/error'                => $views . 'error.php',
    '/login'                => $site . 'login.php',
    '/logout'               => $site . 'logout.php',
    '/contact'              => $site . 'contact.php',
    '/about'                => $site . 'about.php',
    '/register'             => $site . 'register.php',
    '/register_success'     => $site . 'register_success.php',
    '/profile'              => $user . 'profile.php',
    '/update'               => $user . 'update.php',
    '/admin'                => $admin . 'admin.php'
);

if ($_SERVER['REQUEST_URI'] == '/')
    $_SERVER['REQUEST_URI'] = '/home';

preg_match('/^([\w\/]+)/', $_SERVER['REQUEST_URI'], $matches);
$matches[1] = isset($matches[1]) ? $matches[1] : null;

include('themes/default/views/layouts/main.php');

main.php

if(array_key_exists($matches[1], $includes)) {
    $content = include($includes[$matches[1]]);
} else $content = include('views/error.php');

Fixed, the first time should give some errors, but deleting cache (ccleaner) will do the trick.

Links like: site.com/home and site.com/login?error=1 (in html with /home so it won't give any error)

Thank YOU!