forked from manuelkiessling/nodebeginner.org
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
extensive page/site performance optimizations
- Loading branch information
1 parent
206e364
commit fc8a94d
Showing
7 changed files
with
115 additions
and
28 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
AddType x-mapp-php5 .php .shtml .html .htm .txt .js .css .png .jpg .gif |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
<?php | ||
|
||
$output = ob_get_clean(); // Gesamte Ausgabe, die an den Client gesendet werden soll, abfangen und zwischenspeichern | ||
|
||
$etag = '"'.sha1($output).'"'; // Prüfsumme der Ausgabe berechnen// Ist der Inhalt identisch mit dem, den der Client gecached hat? | ||
if ($_SERVER['HTTP_IF_NONE_MATCH'] == $etag) // Wenn ja, dann sende nur den Status 304 | ||
{ | ||
header('HTTP/1.x 304 Not Modified'); | ||
header('Etag: '.$etag); | ||
die(); | ||
} | ||
else // Wenn nicht, dann sende den Inhalt inkl. des neuen Etags | ||
{ | ||
header('Etag: '.$etag); | ||
echo $output; | ||
die(); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
<?php | ||
|
||
ob_start(); | ||
|
||
$pathinfo = pathinfo($_ENV['SCRIPT_FILENAME']); | ||
$extension = $pathinfo['extension']; | ||
|
||
if ($extension != 'html') { | ||
header('Cache-Control: max-age=604800'); // 1 week | ||
} | ||
|
||
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'); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
short_open_tag=off | ||
output_handler=ob_gzhandler | ||
auto_prepend_file=/kunden/homepages/0/d271931425/htdocs/www.nodebeginner.org/header.php | ||
auto_append_file=/kunden/homepages/0/d271931425/htdocs/www.nodebeginner.org/footer.php |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
AddType x-mapp-php5 .php .shtml .html .htm .txt .js .css .png .jpg .gif |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
short_open_tag=off | ||
output_handler=ob_gzhandler | ||
auto_prepend_file=/kunden/homepages/0/d271931425/htdocs/www.nodebeginner.org/header.php | ||
auto_append_file=/kunden/homepages/0/d271931425/htdocs/www.nodebeginner.org/footer.php |