-
Notifications
You must be signed in to change notification settings - Fork 65
Expand file tree
/
Copy path.htaccess
More file actions
43 lines (33 loc) · 1.21 KB
/
.htaccess
File metadata and controls
43 lines (33 loc) · 1.21 KB
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
RewriteEngine On
# Redirect IP to main site
RewriteCond %{HTTP_HOST} ^50\.251\.58\.13$
RewriteRule ^ https://imagemagick.org/ [R=301,L]
# Redirect www → non-www
RewriteCond %{HTTP_HOST} ^www\.imagemagick\.org$ [NC]
RewriteRule ^ https://imagemagick.org%{REQUEST_URI} [R=301,L]
# Force HTTPS except for raw IP
RewriteCond %{HTTPS} off
RewriteCond %{HTTP_HOST} !^50\.251\.58\.13$
RewriteRule ^ https://%{HTTP_HOST}%{REQUEST_URI} [R=301,L]
# Redirect /Usage*
RewriteRule ^Usage https://usage.imagemagick.org/ [R=301,L]
# MIME type
AddType application/epub+zip .epub
# Cache static files
<FilesMatch "\.(pdf|epub|mp4|webp|jpg|jpeg|png|gif|css|js)$">
Header set Cache-Control "max-age=2592000, public"
</FilesMatch>
# Protect .htaccess
<Files ".htaccess">
Require all denied
</Files>
# Hotlink protection
RewriteCond %{HTTP_REFERER} !^$
RewriteCond %{HTTP_REFERER} !^https://(www\.)?imagemagick\.org/ [NC]
RewriteRule \.(pdf|epub|mp4|webp|jpg|jpeg|png|gif)$ - [F]
# Restrict download.imagemagick.org to /archive
RewriteCond %{HTTP_HOST} ^download\.imagemagick\.org$ [NC]
RewriteCond %{REQUEST_URI} !^/archive(?:/|$) [NC]
RewriteRule ^ https://download.imagemagick.org/archive/ [R=301,L]
# Custom 404
# ErrorDocument 404 /404.html