# Disallow all HTTP methods other than GET, POST and HEAD
RewriteCond %{REQUEST_METHOD} !^(GET|POST|HEAD)
RewriteRule .* - [R=405,L]
# Cache media files for one week
<FilesMatch ".(js|css|gif|jpg|jpeg|png|ico)$">
Header set Cache-Control "max-age=604800"
</FilesMatch>
# Enable URL rewriting
RewriteEngine On
RewriteBase /
# Force <www> on bare domain (note: list other subdomains than <www> in second line in place of <m>)
RewriteCond %{HTTP_HOST} !^$
RewriteCond %{HTTP_HOST} !^(www|m). [NC]
RewriteCond %{HTTPS}s ^on(s)|
RewriteRule ^ http%1://www.%{HTTP_HOST}%{REQUEST_URI} [R=301,L]