I missed a dot
I edited it above, and considered posting to point the fact out, but decided against it, and hoped you'd remember how famously untested all my code is and not copy-and-paste it. 
Your code can be vastly simplified using an array, and you should always use isset() to check for undefined variables.
Code:
<?php
if(isset($_POST['id'])) {
$p = array(
array('RED', '/red/index.php'),
array('BLUE', '/blue/index.php'),
array('YELLOW', '/yellow/index.php'),
array('GREEN', '/green/index.php')
);
if(!isset($p[$_POST['id'])) header("Location: " . 'http://' . $_SERVER['HTTP_HOST'] . substr($_SERVER['REQUEST_URI'], 0, strrpos($_SERVER['REQUEST_URI'], '/')) . "/index.php");
if($_POST['pass'] === $p[$_POST['id']][0])
header('Location: http://' . $_SERVER['HTTP_HOST'] . $p[$_POST['id'][1] . '?pass=' . $_POST['pass']);
else
header("Location: " . 'http://' . $_SERVER['HTTP_HOST'] . substr($_SERVER['REQUEST_URI'], 0, strrpos($_SERVER['REQUEST_URI'], '/')) . '/error.php');
} else {
?>
Bookmarks