forked from manuelkiessling/nodebeginner.org
-
Notifications
You must be signed in to change notification settings - Fork 0
/
header.php
38 lines (28 loc) · 772 Bytes
/
header.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
27
28
29
30
31
32
33
34
35
36
37
38
<?php
ob_start();
$httpHost = $_SERVER['HTTP_HOST'];
$requestUri = $_SERVER['REQUEST_URI'];
$queryString = $_SERVER['QUERY_STRING'];
$pathinfo = pathinfo($_ENV['SCRIPT_FILENAME']);
$extension = $pathinfo['extension'];
if ($extension != 'html') {
header('Cache-Control: max-age=604800'); // 1 week
}
if ($extension == 'html') {
header('Content-type: text/html; charset=utf-8');
}
if ($extension == 'css') {
header('Content-type: text/css; charset=utf-8');
}
if ($extension == 'js') {
header('Content-type: text/javascript; charset=utf-8');
}
if ($extension == 'png') {
header('Content-type: image/png');
}
if ($extension == 'jpg') {
header('Content-type: image/jpeg');
}
if ($extension == 'gif') {
header('Content-type: image/gif');
}