This repository has been archived by the owner on Jan 3, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy path.htaccess
207 lines (157 loc) · 8.5 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
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
# ------------------------------------------------------------------------------
# | Block referrer spam |
# ------------------------------------------------------------------------------
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteCond %{HTTP_REFERER} ^http(s)?://([^.]+\.)?kambasoft.com/ [NC,OR]
RewriteCond %{HTTP_REFERER} ^http(s)?://([^.]+\.)?buttons\-for\-website.com/ [NC,OR]
RewriteCond %{HTTP_REFERER} ^http(s)?://([^.]+\.)?7makemoneyonline.com/ [NC,OR]
RewriteCond %{HTTP_REFERER} ^http(s)?://([^.]+\.)?savetubevideo.com/ [NC,OR]
RewriteCond %{HTTP_REFERER} ^http(s)?://([^.]+\.)?semalt.com/ [NC]
RewriteRule .* - [F]
</IfModule>
# ------------------------------------------------------------------------------
# | Secure Sockets Layer (SSL) |
# ------------------------------------------------------------------------------
# Rewrite secure requests properly in order to prevent SSL certificate warnings.
# E.g.: prevent `https://www.example.com` when your certificate only allows
# `https://secure.example.com`.
# <IfModule mod_rewrite.c>
# RewriteEngine on
# RewriteCond %{SERVER_PORT} !^443
# RewriteCond %{HTTP_HOST} !hex.pwcc.cc$ [NC]
# RewriteCond %{HTTP_HOST} !on.pwcc.cc$ [NC]
# RewriteRule ^ https://peterwilson.cc%{REQUEST_URI} [R=301,L]
# </IfModule>
# ------------------------------------------------------------------------------
# | Avoid duplicate images |
# ------------------------------------------------------------------------------
# redirect shared/content/uploads to /content/uploads
# E.g.: prevent `https://www.example.com` when your certificate only allows
# `https://secure.example.com`.
<IfModule mod_rewrite.c>
RewriteEngine on
RedirectMatch 301 /shared/content/uploads/(.*) /content/uploads/$1
</IfModule>
# ------------------------------------------------------------------------------
# | various redirects |
# ------------------------------------------------------------------------------
<IfModule mod_rewrite.c>
RewriteEngine on
RewriteRule ^notes/(.+) https://%{HTTP_HOST}/~/$1 [NC,R=301,L]
RewriteRule ^notes/?$ https://%{HTTP_HOST}/~/ [NC,R=301,L]
RewriteRule ^1664/?$ https://%{HTTP_HOST}/status-1664/ [NC,R=301,L]
RewriteRule ^1697/?$ https://%{HTTP_HOST}/status-1697/ [NC,R=301,L]
RewriteRule ^SunshineCoastDaily.21-08-2007.pdf$ https://%{HTTP_HOST}/profinvest/ [NC,R=301,L]
RewriteRule ^cool-i-think-i-broke-we-mentions-either-that-or-im-impatient-we-shall-see/?$ https://%{HTTP_HOST}/status-1777/ [NC,R=301,L]
</IfModule>
<IfModule mod_rewrite.c>
RewriteEngine on
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_URI} ^(.*)\.([0-9A-Fa-f]+)\.(js|css)$
RewriteRule ^(.*)\.([0-9A-Fa-f]+)\.(js|css)$ $1.$3 [L]
</IfModule>
# ------------------------------------------------------------------------------
# | File access |
# ------------------------------------------------------------------------------
# Block access to directories without a default document.
# Usually you should leave this uncommented because you shouldn't allow anyone
# to surf through every directory on your server (which may includes rather
# private places like the CMS's directories).
<IfModule mod_autoindex.c>
Options -Indexes
</IfModule>
# ------------------------------------------------------------------------------
# | Compression |
# ------------------------------------------------------------------------------
<IfModule mod_deflate.c>
# Force compression for mangled headers.
# http://developer.yahoo.com/blogs/ydn/posts/2010/12/pushing-beyond-gzipping
<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>
# Compress all output labeled with one of the following MIME-types
# (for Apache versions below 2.3.7, you don't need to enable `mod_filter`
# and can remove the `<IfModule mod_filter.c>` and `</IfModule>` lines
# as `AddOutputFilterByType` is still in the core directives).
<IfModule mod_filter.c>
AddOutputFilterByType DEFLATE application/atom+xml \
application/javascript \
application/json \
application/rss+xml \
application/vnd.ms-fontobject \
application/x-font-ttf \
application/x-web-app-manifest+json \
application/xhtml+xml \
application/xml \
font/opentype \
image/svg+xml \
image/x-icon \
text/css \
text/html \
text/plain \
text/x-component \
text/xml
</IfModule>
</IfModule>
# ------------------------------------------------------------------------------
# | ETag
# ------------------------------------------------------------------------------
FileETag MTime Size
# ------------------------------------------------------------------------------
# | Expires headers (for better cache control) |
# ------------------------------------------------------------------------------
# The following expires headers are set pretty far in the future. If you don't
# control versioning with filename-based cache busting, consider lowering the
# cache time for resources like CSS and JS to something like 1 week.
<IfModule mod_expires.c>
ExpiresActive on
ExpiresDefault "access plus 1 month"
# CSS
ExpiresByType text/css "access plus 3 hours"
# Data interchange
ExpiresByType application/json "access plus 0 seconds"
ExpiresByType application/xml "access plus 0 seconds"
ExpiresByType text/xml "access plus 0 seconds"
# Favicon (cannot be renamed!) and cursor images
ExpiresByType image/x-icon "access plus 1 week"
# HTML components (HTCs)
ExpiresByType text/x-component "access plus 1 month"
# HTML
ExpiresByType text/html "access plus 0 seconds"
# JavaScript
ExpiresByType application/javascript "access plus 3 hours"
# Manifest files
ExpiresByType application/x-web-app-manifest+json "access plus 0 seconds"
ExpiresByType text/cache-manifest "access plus 0 seconds"
# Media
ExpiresByType audio/ogg "access plus 1 month"
ExpiresByType image/gif "access plus 1 month"
ExpiresByType image/jpeg "access plus 1 month"
ExpiresByType image/png "access plus 1 month"
ExpiresByType video/mp4 "access plus 1 month"
ExpiresByType video/ogg "access plus 1 month"
ExpiresByType video/webm "access plus 1 month"
# Web feeds
ExpiresByType application/atom+xml "access plus 1 hour"
ExpiresByType application/rss+xml "access plus 1 hour"
# Web fonts
ExpiresByType application/font-woff "access plus 3 hours"
ExpiresByType application/vnd.ms-fontobject "access plus 3 hours"
ExpiresByType application/x-font-ttf "access plus 3 hours"
ExpiresByType font/opentype "access plus 3 hours"
ExpiresByType image/svg+xml "access plus 3 hours"
</IfModule>
# BEGIN WordPress
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /
RewriteRule ^index\.php$ - [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /index.php [L]
</IfModule>
# END WordPress