-
-
Save Zauberfisch/d681474df67ced83ec1f to your computer and use it in GitHub Desktop.
This file contains hidden or 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
ErrorDocument 404 /assets/error-404.html | |
ErrorDocument 500 /assets/error-500.html | |
<Files *.ss> | |
Order deny,allow | |
Deny from all | |
Allow from 127.0.0.1 | |
</Files> | |
<Files web.config> | |
Order deny,allow | |
Deny from all | |
</Files> | |
<Files ~ "\.ya?ml$"> | |
Order allow,deny | |
Deny from all | |
</Files> | |
<IfModule mod_rewrite.c> | |
Options +FollowSymlinks | |
# Start the rewrite engine | |
RewriteEngine On | |
RewriteBase / | |
# REDIRECT ANY DIRECT IMAGE REQUEST TO A CACHED VERSION | |
RewriteCond %{REQUEST_FILENAME} -f | |
RewriteCond %{ENV:REDIRECT_BREAKPOINT} !\d+px | |
RewriteCond %{QUERY_STRING} !^([^&]*&)*squeezr=(0|false|no) | |
RewriteCond %{HTTP_COOKIE} squeezr.images=(\d+px) [NC] | |
RewriteCond %{REQUEST_URI} !cms # exclude the silverstripe cms | |
RewriteCond %{REQUEST_URI} !framework # exclude the silverstripe framework which is by the cms | |
RewriteRule ^(.+)(\.(?:jpe?g|gif|png))$ squeezr/cache/$1-%1$2 [NC,E=BREAKPOINT:%1,L] | |
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ | |
# Please make sure that you set this path ^^^ to the squeezr root directory that is also specified | |
# for the SQUEEZR_ROOT constant in the common engine configuration (SQUEEZR_ROOT/conf/common.php). If you | |
# apply the default setup for squeezr (i.e. put everything into a directory named "squeezr" under your | |
# website's document root), then you shouldn't have to change anything. | |
############################################################################################################# | |
# REDIRECT ANY DIRECT CSS REQUEST TO A CACHED VERSION | |
RewriteCond %{REQUEST_FILENAME} -f | |
RewriteCond %{ENV:REDIRECT_BREAKPOINT} !\d+px | |
RewriteCond %{QUERY_STRING} !^([^&]*&)*squeezr=(0|false|no) | |
RewriteCond %{HTTP_COOKIE} squeezr.css=(\d+x\d+@\d+(?:\.\d+)?) [NC] | |
RewriteCond %{REQUEST_URI} !cms # exclude the silverstripe cms | |
RewriteCond %{REQUEST_URI} !framework # exclude the silverstripe framework which is by the cms | |
RewriteRule ^(.+)\.css$ squeezr/cache/$1-%1.css [NC,E=BREAKPOINT:%1,L] | |
# ~~~~~~~~~~~~~~~~~~~~~~~~~~ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ | |
# See above for hints on ^^^ this path. | |
############################################################################################################# | |
### SILVERSTRIPE START ### | |
RewriteRule ^vendor(/|$) - [F,L,NC] | |
RewriteRule silverstripe-cache(/|$) - [F,L,NC] | |
RewriteRule composer\.(json|lock) - [F,L,NC] | |
RewriteCond %{REQUEST_URI} ^(.*)$ | |
RewriteCond %{REQUEST_FILENAME} !-f | |
RewriteCond %{REQUEST_URI} !\.php$ | |
RewriteRule .* framework/main.php?url=%1 [QSA] | |
RewriteCond %{REQUEST_URI} ^(.*)/framework/main.php$ | |
RewriteCond %{REQUEST_FILENAME} !-f | |
RewriteRule . %1/install.php? [R,L] | |
### SILVERSTRIPE END ### | |
</IfModule> | |
############################################################################################################# | |
# Additional stuff for improving your website's delivery performance | |
############################################################################################################# | |
<IfModule mod_deflate.c> | |
AddOutputFilterByType DEFLATE text/plain text/html text/xml text/css text/javascript text/json text/x-json text/x-json-stream application/x-javascript application/json application/x-json application/x-json-stream application/.*xml.* multipart/x-json-stream multipart/x-mixed-replace image/svg+xml | |
</IfModule> | |
<IfModule mod_expires.c> | |
ExpiresActive on | |
# Images | |
ExpiresByType image/gif "access plus 35 days" | |
ExpiresByType image/png "access plus 35 days" | |
ExpiresByType image/jpg "access plus 35 days" | |
ExpiresByType image/jpeg "access plus 35 days" | |
# Text based files | |
ExpiresByType text/css "access plus 35 days" | |
ExpiresByType text/xml "access plus 35 days" | |
ExpiresByType text/javascript "access plus 35 days" | |
ExpiresByType application/x-shockwave-flash "access plus 35 days" | |
# Default expiration | |
ExpiresDefault "access plus 1 days" | |
</IfModule> | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment