-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathrouter.php
More file actions
25 lines (18 loc) · 702 Bytes
/
Copy pathrouter.php
File metadata and controls
25 lines (18 loc) · 702 Bytes
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
<?php
// router.php
//Files in the foundation folder (if present) should be ignored by all rules below.
if (preg_match('/_\/(bower_components|foundation).*?\.css/', $_SERVER["REQUEST_URI"])) {
return false;
}
//Handle CSS files, serving up the pre-processed file from the .tmp folder instead of the app folder.
if (preg_match('/\.(?:css)$/', $_SERVER["REQUEST_URI"])) {
$serverPath = $_SERVER["DOCUMENT_ROOT"];
//$urlPath = str_ireplace("/", "\\", $_SERVER["REQUEST_URI"]);
$urlPath = $_SERVER["REQUEST_URI"];
$filePath = str_ireplace("app", ".tmp", $serverPath . $urlPath);
header('Content-type: text/css');
echo(file_get_contents($filePath));
} else {
return false;
}
?>