forked from jlopp/lopp.net
-
Notifications
You must be signed in to change notification settings - Fork 0
/
.htaccess
86 lines (74 loc) · 3.29 KB
/
.htaccess
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
Options +FollowSymlinks
Options -MultiViews
RewriteEngine On
RewriteBase /
# Handle typos, redirect from old URLs
RewriteRule ^[b|B][i|I][t|T][c|C][o|O][i|I][n|N]\.html$ /bitcoin-information.html [R=301]
RewriteRule ^[b|B][i|I][t|T][c|C][o|O][i|I][n|N]\.?$ /bitcoin-information.html [R=301]
RewriteRule ^[l|L][i|I][g|G][h|H][t|T][n|N][i|I][n|N][g|G]$ /lightning-information.html [R=301]
RewriteRule ^[l|L][i|I][g|G][h|H][t|T][n|N][i|I][n|N][g|G]\.html$ /lightning-information.html [R=301]
# Redirect non-www to www subdomain to enable CDN
RewriteCond %{HTTP_HOST} !^www\. [NC,OR]
# Redirect to https (Cloudflare enabled)
RewriteCond %{HTTP:CF-Visitor} '"scheme":"http"'
# Redirect to https (Cloudflare disabled)
# RewriteCond %{HTTPS} off
RewriteRule ^ https://www.lopp.net%{REQUEST_URI} [NE,R=301,L]
# Hide file extensions
RewriteRule ^contact$ https://%{HTTP_HOST}/contact.php [R=301,L]
RewriteRule ^bitcoin-information$ /bitcoin-information.html [R=301]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME}\.html -f
RewriteRule ^(.*)$ https://%{HTTP_HOST}/$1\.html [R=301,L]
#Redirect index.html to / to prevent duplicate pages being indexed
RewriteRule ^index\.html$ / [R=301]
AddType x-mapp-php5 .php
AddType image/x-icon .ico
AddType 'text/html; charset=UTF-8' html
AddDefaultCharset utf-8
<IfModule mod_expires.c>
ExpiresActive On
# Media: images, video, audio
ExpiresByType image/jpg "access plus 1 month"
ExpiresByType image/jpeg "access plus 1 month"
ExpiresByType image/gif "access plus 1 month"
ExpiresByType image/webp "access plus 1 month"
ExpiresByType image/png "access plus 1 month"
ExpiresByType image/x-icon "access plus 1 year"
ExpiresByType application/pdf "access plus 1 month"
ExpiresByType audio/mp3 "access plus 1 year"
# Webfonts
ExpiresByType font/truetype "access plus 1 month"
ExpiresByType font/opentype "access plus 1 month"
ExpiresByType application/x-font-woff "access plus 1 month"
ExpiresByType image/svg+xml "access plus 1 month"
ExpiresByType application/vnd.ms-fontobject "access plus 1 month"
# CSS and JavaScript
ExpiresByType text/css "access plus 1 week"
ExpiresByType application/javascript "access plus 1 week"
ExpiresByType text/javascript "access plus 1 week"
# Misc
ExpiresByType text/html "access plus 1 day"
ExpiresDefault "access plus 2 days"
<IfModule mod_headers.c>
Header append Cache-Control "public"
</IfModule>
</IfModule>
<IfModule mod_deflate.c>
AddOutputFilterByType DEFLATE text/plain
AddOutputFilterByType DEFLATE text/html
AddOutputFilterByType DEFLATE text/xml
AddOutputFilterByType DEFLATE text/shtml
AddOutputFilterByType DEFLATE text/css
AddOutputFilterByType DEFLATE application/xml
AddOutputFilterByType DEFLATE application/xhtml+xml
AddOutputFilterByType DEFLATE application/rss+xml
AddOutputFilterByType DEFLATE application/javascript
AddOutputFilterByType DEFLATE application/x-javascript
</IfModule>
<IfModule mod_headers.c>
Header set Content-Security-Policy "script-src 'self' https://platform.twitter.com https://cdn.syndication.twimg.com https://syndication.twitter.com 'unsafe-inline'"
Header always set X-FRAME-OPTIONS "DENY"
</IfModule>
ErrorDocument 404 /404.html