-
Notifications
You must be signed in to change notification settings - Fork 0
/
router.php
26 lines (24 loc) · 1.28 KB
/
router.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
<?php
// ************************************************************************** //
// //
// ::: :::::::: //
// router.php :+: :+: :+: //
// +:+ +:+ +:+ //
// By: jlagneau <jlagneau@student.42.fr> +#+ +:+ +#+ //
// +#+#+#+#+#+ +#+ //
// Created: 2017/03/19 05:51:13 by jlagneau #+# #+# //
// Updated: 2017/03/19 06:19:22 by jlagneau ### ########.fr //
// //
// ************************************************************************** //
// Usage exemple:
// php -S 127.0.0.1:8001 router.php
if (php_sapi_name() == 'cli-server') {
if ('/config/setup.php' === $_SERVER['REQUEST_URI'] &&
in_array($_SERVER['REMOTE_ADDR'], ['::1', '127.0.0.1'])) {
return false;
} elseif (preg_match('#^/(\.|src|config|router.php|README.md)#', $_SERVER['REQUEST_URI'])) {
header('Location: /404');
} else {
return false;
}
}