## My Example Project - .htaccess setting to improve Webpagetest scores!

Nature of America - My Example Project Site

`.htaccess` file:

    # default to index.html
    DirectoryIndex index.html

    # BEGIN Expire headers
    <IfModule mod_expires.c>
      # Turn on the module.
      ExpiresActive on
      # Set the default expiry times.
      ExpiresDefault "now"
      ExpiresByType image/jpg "access plus 1 month"
      ExpiresByType image/svg+xml "access 1 month"
      ExpiresByType image/gif "access plus 1 month"
      ExpiresByType image/jpeg "access plus 1 month"
      ExpiresByType image/png "access plus 1 month"
      ExpiresByType text/css "access plus 1 month"
      ExpiresByType text/javascript "access plus 1 month"
      ExpiresByType application/javascript "access plus 1 month"
      ExpiresByType image/ico "access plus 1 month"
      ExpiresByType image/x-icon "access plus 1 month"
      ExpiresByType text/html "access plus 600 seconds"
    </IfModule>
    # END Expire headers

    # Security Policy that determines domains that resources can load from
    <IfModule mod_headers.c>
      Header set Strict-Transport-Security "max-age=2592000; includeSubDomains; preload"
      Header set Content-Security-Policy: "default-src 'self'; img-src 'self' cdn.jsdelivr.net; script-src 'self' 'unsafe-eval' code.jquery.com cdn.jsdelivr.net *.cloudflare.com; style-src 'self' *.jsdelivr.net *.cloudflare.com fonts.gstatic.com fonts.googleapis.com; font-src 'self' fonts.gstatic.com fonts.googleapis.com"
      Header set X-Frame-Options: DENY
    </IfModule>

    # compress (DEFLATE) files that are text
    <IfModule mod_deflate.c>
      AddOutputFilterByType DEFLATE text/html text/css text/javascript application/javascript application/json
    </IfModule>
    Options -Indexes

    # All errors will go to a common error file
    ErrorDocument 404 /underconstruction.html
    ErrorDocument 403 /underconstruction.html
    ErrorDocument 500 /underconstruction.html

    # Shouldn't publish from a git checkout anyway,
    #   but just in case, sent requests trying to access .git to 404
    RedirectMatch 404 /\.git