Skip to content

Commit d4c2caa

Browse files
Paul LloydPaul Lloyd
Paul Lloyd
authored and
Paul Lloyd
committed
Reduce size of .htaccess
1 parent 64eeaa9 commit d4c2caa

File tree

1 file changed

+27
-70
lines changed

1 file changed

+27
-70
lines changed

.htaccess

+27-70
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
1-
# ----------------------------------------------------------------------
1+
# -----------------------
22
# Kirby URL rewrite rules
3-
# ----------------------------------------------------------------------
3+
# -----------------------
44
<IfModule mod_rewrite.c>
55
RewriteEngine on
66
RewriteBase /
@@ -10,7 +10,6 @@
1010
RewriteCond %{HTTPS} !=on
1111
RewriteCond %{HTTP_HOST} !^bradshawsguide\.dev$ [NC]
1212
RewriteCond %{HTTP_HOST} !^bradshawsguide\.org$ [NC]
13-
RewriteCond %{HTTP_HOST} !^static\.bradshawsguide\.org$ [NC]
1413
RewriteRule ^(.*)$ http://bradshawsguide.org/$1 [R=301,L]
1514

1615
# Rewrite cache busting query strings on static files
@@ -22,11 +21,6 @@
2221
RewriteCond %{REQUEST_FILENAME} !-d
2322
RewriteRule ^(.*) index.php [L]
2423

25-
# Make panel links work
26-
RewriteCond %{REQUEST_FILENAME} !-f
27-
RewriteCond %{REQUEST_FILENAME} !-d
28-
RewriteRule ^panel/(.*) panel/index.php [L]
29-
3024
# Block text files in the content folder from being accessed directly
3125
RewriteRule ^content/(.*)\.(txt|md|mdown)$ error [R=301,L]
3226

@@ -38,19 +32,19 @@
3832
</IfModule>
3933

4034

41-
# ----------------------------------------------------------------------
35+
# --------------
4236
# UTF-8 Encoding
43-
# ----------------------------------------------------------------------
37+
# --------------
4438
# Use utf-8 encoding for anything served text/plain or text/html
4539
AddDefaultCharset utf-8
4640

4741
# Force utf-8 for a number of file formats
4842
AddCharset utf-8 .html .php .css .js .xml .json .rss
4943

5044

51-
# ----------------------------------------------------------------------
45+
# ------------
5246
# PHP Settings
53-
# ----------------------------------------------------------------------
47+
# ------------
5448
<IfModule php5_module>
5549
# Use php5
5650
AddHandler php5-script .php
@@ -63,84 +57,52 @@
6357
</IfModule>
6458

6559

66-
# ----------------------------------------------------------------------
67-
# Better website experience for IE users
68-
# ----------------------------------------------------------------------
69-
# Force the latest IE version, in various cases when it may fall back to IE7 mode
70-
# Use ChromeFrame if it's installed for a better experience for the poor IE folk
71-
72-
<IfModule mod_headers.c>
73-
Header set X-UA-Compatible "IE=Edge,chrome=1"
74-
<FilesMatch "\.(js|css|gif|png|jpe?g|pdf|xml|oga|ogg|m4a|ogv|mp4|m4v|webm|svg|svgz|eot|ttf|otf|woff|ico|webp|appcache|manifest|htc|crx|xpi|safariextz|vcf)$" >
75-
# mod_headers can't match by content-type, but we don't want to send this header on everything...
76-
Header unset X-UA-Compatible
77-
</FilesMatch>
78-
</IfModule>
79-
80-
81-
# ----------------------------------------------------------------------
60+
# ------------------------------
8261
# Proper MIME type for all files
83-
# ----------------------------------------------------------------------
62+
# ------------------------------
8463
# Images
85-
AddType image/x-icon ico
86-
AddType image/webp webp
87-
AddType image/svg+xml svg
64+
AddType image/svg+xml svg
8865

8966
# Other
90-
AddType application/javascript js
91-
AddType application/atom+xml xml
92-
AddType application/opensearchdescription+xml xml
93-
AddType application/x-font-ttf ttf
67+
AddType application/javascript js
68+
AddType application/x-font-ttf ttf
9469

9570

96-
# ----------------------------------------------------------------------
71+
# -----------
9772
# Performance
98-
# ----------------------------------------------------------------------
73+
# -----------
9974
<IfModule mod_headers.c>
100-
# FileETag None is not enough for every server.
75+
# FileETag None is not enough for every server
10176
Header unset ETag
10277
</IfModule>
10378

104-
# Since we're sending far-future expires, we don't need ETags for static content.
79+
# Since we're sending far-future expires, we don't need ETags for static content
10580
FileETag None
10681

10782
<IfModule mod_expires.c>
10883
# Set expires headers
10984
ExpiresActive on
110-
111-
# Perhaps better to whitelist expires rules? Perhaps.
112-
ExpiresDefault "access plus 1 day"
85+
ExpiresDefault "access plus 1 day"
11386

11487
# HTML
115-
ExpiresByType text/html "access plus 10 minutes"
116-
117-
# Data
118-
ExpiresByType text/xml "access plus 0 seconds"
119-
ExpiresByType application/xml "access plus 0 seconds"
120-
121-
# RSS feeds
122-
ExpiresByType application/rss+xml "access plus 1 hour"
123-
ExpiresByType application/atom+xml "access plus 1 hour"
124-
125-
# Favicon (cannot be renamed)
126-
ExpiresByType image/x-icon "access plus 1 month"
88+
ExpiresByType text/html "access plus 10 minutes"
12789

12890
# Images
129-
ExpiresByType image/png "access plus 1 month"
130-
ExpiresByType image/jpeg "access plus 1 month"
131-
132-
# Web fonts
133-
ExpiresByType application/x-font-ttf "access plus 1 month"
91+
ExpiresByType image/png "access plus 1 month"
92+
ExpiresByType image/jpeg "access plus 1 month"
13493

13594
# CSS and JavaScript
136-
ExpiresByType text/css "access plus 1 year"
137-
ExpiresByType application/javascript "access plus 1 year"
95+
ExpiresByType text/css "access plus 1 year"
96+
ExpiresByType application/javascript "access plus 1 year"
97+
98+
# Web fonts
99+
ExpiresByType application/x-font-ttf "access plus 1 month"
138100
</IfModule>
139101

140102

141-
# ----------------------------------------------------------------------
103+
# ----------------
142104
# GZIP Compression
143-
# ----------------------------------------------------------------------
105+
# ----------------
144106
<IfModule mod_deflate.c>
145107
# Force deflate for mangled headers
146108
<IfModule mod_setenvif.c>
@@ -151,14 +113,9 @@
151113
</IfModule>
152114

153115
# Compress all output labeled with one of the following MIME-types
154-
AddOutputFilterByType DEFLATE application/atom+xml \
155-
application/javascript \
156-
application/rss+xml \
157-
application/xhtml+xml \
158-
application/xml \
116+
AddOutputFilterByType DEFLATE application/javascript \
159117
application/x-font-ttf \
160118
image/svg+xml \
161-
image/x-icon \
162119
text/css \
163120
text/html \
164121
text/plain \

0 commit comments

Comments
 (0)