WeeklyOSM/Webserver configuration

From OpenStreetMap Wiki
Jump to navigation Jump to search

.htaccess

Use browser to cache static assets

On both web servers include the following section to set caching in browsers correctly

 # BEGIN Cache Expire Headers
 <IfModule mod_expires.c>
 ExpiresActive On
 ExpiresByType application/javascript "access plus 1 week"
 ExpiresByType application/x-javascript "access plus 1 week"
 ExpiresByType image/gif "access plus 1 week"
 ExpiresByType image/jpeg "access plus 1 week"
 ExpiresByType image/png "access plus 1 week"
 ExpiresByType image/x-icon "access plus 1 week"
 ExpiresByType image/svg+xml "access plus 1 week"
 ExpiresByType text/css "access plus 1 week" 
 ExpiresByType image/vnd.microsoft.icon "access plus 1 week"
 </IfModule>
 # END Cache Expire Headers

Compress text during transmission to the browser

Shared hosting on 1and1 does not offer gzip compression. blog.openstreetmap.de does and is controlled by the .htaccess file

# BEGIN Compress certain file types
<IfModule mod_deflate.c>
AddOutputFilterByType DEFLATE text/html
AddOutputFilterByType DEFLATE application/javascript
AddOutputFilterByType DEFLATE text/css
AddOutputFilterByType DEFLATE image/svg+xml
AddOutputFilterByType DEFLATE image/vnd.microsoft.icon
</IfModule>
# END Compress certain file types