Last active
December 15, 2020 12:52
-
-
Save domtra/c8c7c920533b96253612c6afb2d986ee to your computer and use it in GitHub Desktop.
stripped down h5bp .htaccess
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
# Apache Server Configs v3.2.1 | MIT License | |
# https://github.com/h5bp/server-configs-apache | |
<IfModule mod_rewrite.c> | |
RewriteEngine on | |
# RewriteCond %{HTTP_HOST} !^$ | |
# RewriteCond %{HTTP_HOST} !^www\. [NC] | |
# # RewriteCond %{HTTPS}s ^on(s)| | |
# # RewriteRule ^ http%1://www.%{HTTP_HOST}%{REQUEST_URI} [R=301,L] | |
# RewriteRule ^ https://www.%{HTTP_HOST}%{REQUEST_URI} [R=301,L] | |
RewriteCond %{HTTPS} off | |
RewriteRule ^ https://%{HTTP_HOST}%{REQUEST_URI} [R=301,L,NE] | |
</IfModule> | |
Options -MultiViews | |
<IfModule mod_headers.c> | |
Header set X-UA-Compatible "IE=edge" "expr=%{CONTENT_TYPE} =~ m#text/html#i" | |
</IfModule> | |
<IfModule mod_mime.c> | |
AddType application/atom+xml atom | |
AddType application/json json map topojson | |
AddType application/ld+json jsonld | |
AddType application/rss+xml rss | |
AddType application/geo+json geojson | |
AddType application/rdf+xml rdf | |
AddType application/xml xml | |
AddType text/javascript js mjs | |
AddType application/manifest+json webmanifest | |
AddType application/x-web-app-manifest+json webapp | |
AddType text/cache-manifest appcache | |
AddType audio/mp4 f4a f4b m4a | |
AddType audio/ogg oga ogg opus | |
AddType image/bmp bmp | |
AddType image/svg+xml svg svgz | |
AddType image/webp webp | |
AddType video/mp4 f4v f4p m4v mp4 | |
AddType video/ogg ogv | |
AddType video/webm webm | |
AddType video/x-flv flv | |
AddType image/x-icon cur ico | |
AddType application/wasm wasm | |
AddType font/woff woff | |
AddType font/woff2 woff2 | |
AddType application/vnd.ms-fontobject eot | |
AddType font/ttf ttf | |
AddType font/collection ttc | |
AddType font/otf otf | |
AddType application/octet-stream safariextz | |
AddType application/x-bb-appworld bbaw | |
AddType application/x-chrome-extension crx | |
AddType application/x-opera-extension oex | |
AddType application/x-xpinstall xpi | |
AddType text/calendar ics | |
AddType text/markdown markdown md | |
AddType text/vcard vcard vcf | |
AddType text/vnd.rim.location.xloc xloc | |
AddType text/vtt vtt | |
AddType text/x-component htc | |
</IfModule> | |
AddDefaultCharset utf-8 | |
<IfModule mod_mime.c> | |
AddCharset utf-8 .appcache \ | |
.bbaw \ | |
.css \ | |
.htc \ | |
.ics \ | |
.js \ | |
.json \ | |
.manifest \ | |
.map \ | |
.markdown \ | |
.md \ | |
.mjs \ | |
.topojson \ | |
.vtt \ | |
.vcard \ | |
.vcf \ | |
.webmanifest \ | |
.xloc | |
</IfModule> | |
<IfModule mod_rewrite.c> | |
# (1) | |
RewriteEngine On | |
# (2) | |
Options +FollowSymlinks | |
# (3) | |
# Options +SymLinksIfOwnerMatch | |
# (4) | |
# RewriteBase / | |
# (5) | |
# RewriteOptions <options> | |
# (6) | |
RewriteCond %{HTTPS} =on | |
RewriteRule ^ - [env=proto:https] | |
RewriteCond %{HTTPS} !=on | |
RewriteRule ^ - [env=proto:http] | |
</IfModule> | |
<IfModule mod_autoindex.c> | |
Options -Indexes | |
</IfModule> | |
<IfModule mod_rewrite.c> | |
RewriteEngine On | |
RewriteCond %{REQUEST_URI} "!(^|/)\.well-known/([^./]+./?)+$" [NC] | |
RewriteCond %{SCRIPT_FILENAME} -d [OR] | |
RewriteCond %{SCRIPT_FILENAME} -f | |
RewriteRule "(^|/)\." - [F] | |
</IfModule> | |
<IfModule mod_authz_core.c> | |
<FilesMatch "(^#.*#|\.(bak|conf|dist|fla|in[ci]|log|orig|psd|sh|sql|sw[op])|~)$"> | |
Require all denied | |
</FilesMatch> | |
</IfModule> | |
<IfModule mod_headers.c> | |
Header set X-Content-Type-Options "nosniff" | |
</IfModule> | |
<IfModule mod_headers.c> | |
Header unset X-Powered-By | |
Header always unset X-Powered-By | |
</IfModule> | |
ServerSignature Off | |
<IfModule mod_deflate.c> | |
<IfModule mod_setenvif.c> | |
<IfModule mod_headers.c> | |
SetEnvIfNoCase ^(Accept-EncodXng|X-cept-Encoding|X{15}|~{15}|-{15})$ ^((gzip|deflate)\s*,?\s*)+|[X~-]{4,13}$ HAVE_Accept-Encoding | |
RequestHeader append Accept-Encoding "gzip,deflate" env=HAVE_Accept-Encoding | |
</IfModule> | |
</IfModule> | |
<IfModule mod_filter.c> | |
AddOutputFilterByType DEFLATE "application/atom+xml" \ | |
"application/javascript" \ | |
"application/json" \ | |
"application/ld+json" \ | |
"application/manifest+json" \ | |
"application/rdf+xml" \ | |
"application/rss+xml" \ | |
"application/schema+json" \ | |
"application/geo+json" \ | |
"application/vnd.ms-fontobject" \ | |
"application/wasm" \ | |
"application/x-font-ttf" \ | |
"application/x-javascript" \ | |
"application/x-web-app-manifest+json" \ | |
"application/xhtml+xml" \ | |
"application/xml" \ | |
"font/eot" \ | |
"font/opentype" \ | |
"font/otf" \ | |
"image/bmp" \ | |
"image/svg+xml" \ | |
"image/vnd.microsoft.icon" \ | |
"text/cache-manifest" \ | |
"text/calendar" \ | |
"text/css" \ | |
"text/html" \ | |
"text/javascript" \ | |
"text/plain" \ | |
"text/markdown" \ | |
"text/vcard" \ | |
"text/vnd.rim.location.xloc" \ | |
"text/vtt" \ | |
"text/x-component" \ | |
"text/x-cross-domain-policy" \ | |
"text/xml" | |
</IfModule> | |
<IfModule mod_mime.c> | |
AddEncoding gzip svgz | |
</IfModule> | |
</IfModule> | |
<IfModule mod_headers.c> | |
Header unset ETag | |
</IfModule> | |
FileETag None | |
<IfModule mod_expires.c> | |
ExpiresActive on | |
ExpiresDefault "access plus 1 month" | |
ExpiresByType text/css "access plus 1 year" | |
ExpiresByType application/atom+xml "access plus 1 hour" | |
ExpiresByType application/rdf+xml "access plus 1 hour" | |
ExpiresByType application/rss+xml "access plus 1 hour" | |
ExpiresByType application/json "access plus 0 seconds" | |
ExpiresByType application/ld+json "access plus 0 seconds" | |
ExpiresByType application/schema+json "access plus 0 seconds" | |
ExpiresByType application/geo+json "access plus 0 seconds" | |
ExpiresByType application/xml "access plus 0 seconds" | |
ExpiresByType text/calendar "access plus 0 seconds" | |
ExpiresByType text/xml "access plus 0 seconds" | |
ExpiresByType image/vnd.microsoft.icon "access plus 1 week" | |
ExpiresByType image/x-icon "access plus 1 week" | |
ExpiresByType text/html "access plus 0 seconds" | |
ExpiresByType application/javascript "access plus 1 year" | |
ExpiresByType application/x-javascript "access plus 1 year" | |
ExpiresByType text/javascript "access plus 1 year" | |
ExpiresByType application/manifest+json "access plus 1 week" | |
ExpiresByType application/x-web-app-manifest+json "access plus 0 seconds" | |
ExpiresByType text/cache-manifest "access plus 0 seconds" | |
ExpiresByType text/markdown "access plus 0 seconds" | |
ExpiresByType audio/ogg "access plus 1 year" | |
ExpiresByType image/bmp "access plus 1 year" | |
ExpiresByType image/gif "access plus 1 year" | |
ExpiresByType image/jpeg "access plus 1 year" | |
ExpiresByType image/png "access plus 1 year" | |
ExpiresByType image/svg+xml "access plus 1 year" | |
ExpiresByType image/webp "access plus 1 year" | |
ExpiresByType video/mp4 "access plus 1 year" | |
ExpiresByType video/ogg "access plus 1 year" | |
ExpiresByType video/webm "access plus 1 year" | |
ExpiresByType application/wasm "access plus 1 year" | |
ExpiresByType font/collection "access plus 1 year" | |
ExpiresByType application/vnd.ms-fontobject "access plus 1 year" | |
ExpiresByType font/eot "access plus 1 year" | |
ExpiresByType font/opentype "access plus 1 year" | |
ExpiresByType font/otf "access plus 1 year" | |
ExpiresByType application/x-font-ttf "access plus 1 year" | |
ExpiresByType font/ttf "access plus 1 year" | |
ExpiresByType application/font-woff "access plus 1 year" | |
ExpiresByType application/x-font-woff "access plus 1 year" | |
ExpiresByType font/woff "access plus 1 year" | |
ExpiresByType application/font-woff2 "access plus 1 year" | |
ExpiresByType font/woff2 "access plus 1 year" | |
ExpiresByType text/x-cross-domain-policy "access plus 1 week" | |
</IfModule> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment