# Green Stone — speed: compression + browser caching
<IfModule mod_deflate.c>
  AddOutputFilterByType DEFLATE text/html text/plain text/xml text/css text/javascript application/javascript application/json image/svg+xml
</IfModule>
<IfModule mod_expires.c>
  ExpiresActive On
  ExpiresByType image/jpeg "access plus 6 months"
  ExpiresByType image/png "access plus 6 months"
  ExpiresByType image/webp "access plus 6 months"
  ExpiresByType text/css "access plus 1 month"
  ExpiresByType application/javascript "access plus 1 month"
  ExpiresByType text/html "access plus 1 hour"
</IfModule>
<IfModule mod_headers.c>
  <FilesMatch "\.(jpg|jpeg|png|webp)$">
    Header set Cache-Control "public, max-age=15552000, immutable"
  </FilesMatch>
  <FilesMatch "\.(css|js)$">
    Header set Cache-Control "public, max-age=2592000"
  </FilesMatch>
</IfModule>

# Clean URLs: no .html in addresses
<IfModule mod_rewrite.c>
  RewriteEngine On
  # /index.html -> /
  RewriteRule ^index\.html$ / [R=301,L]
  # /page.html -> /page
  RewriteRule ^(about|products|process|gallery|contact)\.html$ /$1 [R=301,L]
  # strip a trailing slash on non-directories
  RewriteCond %{REQUEST_FILENAME} !-d
  RewriteRule ^(.+)/$ /$1 [R=301,L]
  # serve /page from /page.html
  RewriteCond %{REQUEST_FILENAME} !-d
  RewriteCond %{REQUEST_FILENAME}\.html -f
  RewriteRule ^(.+)$ $1.html [L]
</IfModule>
