if ($this->isHosting()) {
$redirections = Json::isJson($this->redirections) ? json_decode($this->redirections, true) : $this->redirections;
+ $expires = 3600 * 24 * 30;
+
$content = '<IfModule mod_rewrite.c>
<IfModule mod_negotiation.c>
Options -MultiViews -Indexes
}
$content .= ' RewriteRule ' . $redirection['from'] . ' /' . ltrim($redirection['to'], '/') . " [R=308,L]\n";
}
- $content .= '</IfModule>' . "\n";
+ $content .= '</IfModule>
+<IfModule mod_headers.c>
+ Header set Cache-Control "max-age=' . $expires . ', public"
+</IfModule>
+<IfModule mod_expires.c>
+ ExpiresActive On
+ ExpiresDefault "access plus ' . $expires . ' seconds"
+</IfModule>';
+
+
$tmp = Files::tempnam();
file_put_contents($tmp, $content);
$this->getTransferDriver()->copyFile($tmp, '.htaccess');
LoadModule rewrite_module /usr/lib/apache2/modules/mod_rewrite.so
+LoadModule expires_module /usr/lib/apache2/modules/mod_expires.so
+LoadModule headers_module /usr/lib/apache2/modules/mod_headers.so
<Directory /var/www/html>
Options Indexes FollowSymLinks