Skip to content

Commit a99b916

Browse files
committed
More Asset refactoring fixes
- Made caching less agressive - Made gulp not delete the .gitkeep file
1 parent 5c5b998 commit a99b916

File tree

2 files changed

+30
-45
lines changed

2 files changed

+30
-45
lines changed

.htaccess

Lines changed: 29 additions & 44 deletions
Original file line numberDiff line numberDiff line change
@@ -1,57 +1,42 @@
11
# COMPRESSION
2-
<IfModule mod_deflate.c>
3-
AddOutputFilterByType DEFLATE text/text text/html text/plain text/xml text/css application/x-javascript application/javascript application/json
4-
</IfModule>
2+
AddOutputFilterByType DEFLATE text/text text/html text/plain text/xml text/css application/x-javascript application/javascript application/json
3+
54

65
# REWRITES
7-
<IfModule mod_rewrite.c>
8-
RewriteEngine On
96

10-
# Let the old ScheduleMaker handle Resig's schedules for now
11-
#RewriteCond %{QUERY_STRING} ^mode=old&id=(.*)$ [NC]
12-
RewriteRule ^schedule.php$ http://schedule-old.csh.rit.edu/schedule.php [NC,L,R=302]
7+
RewriteEngine On
8+
9+
# Let the old ScheduleMaker handle Resig's schedules for now
10+
#RewriteCond %{QUERY_STRING} ^mode=old&id=(.*)$ [NC]
11+
RewriteRule ^schedule.php$ http://schedule-old.csh.rit.edu/schedule.php [NC,L,R=302]
12+
13+
# Legacy Rewrites from previous version
14+
RewriteCond %{QUERY_STRING} ^id=(.*)$ [NC]
15+
RewriteRule ^schedule.php$ /schedule/%1? [NC,L,R=302]
16+
RewriteRule ^(generate|roulette|search|status).php$ /$1 [R=302,L]
1317

14-
# Legacy Rewrites from previous version
15-
RewriteCond %{QUERY_STRING} ^id=(.*)$ [NC]
16-
RewriteRule ^schedule.php$ /schedule/%1? [NC,L,R=302]
17-
RewriteRule ^(generate|roulette|search|status).php$ /$1 [R=302,L]
18+
# Rewrite any request that wants json to the api directory
19+
RewriteCond %{HTTP:Accept} application/json [NC]
20+
RewriteRule ^(schedule|generate|entity|search|status|rmp)(?:/([^/]*))*$ api/$1.php [L]
21+
RewriteRule ^schedule/[^/]*/ical$ api/schedule.php [L]
1822

19-
# Rewrite any request that wants json to the api directory
20-
RewriteCond %{HTTP:Accept} application/json [NC]
21-
RewriteRule ^(schedule|generate|entity|search|status|rmp)(?:/([^/]*))*$ api/$1.php [L]
22-
RewriteRule ^schedule/[^/]*/ical$ api/schedule.php [L]
23+
# Don't rewrite files or directories
24+
RewriteCond %{REQUEST_FILENAME} -f [OR]
25+
RewriteCond %{REQUEST_FILENAME} -d
26+
RewriteRule ^ - [L]
2327

24-
# Don't rewrite files or directories
25-
RewriteCond %{REQUEST_FILENAME} -f [OR]
26-
RewriteCond %{REQUEST_FILENAME} -d
27-
RewriteRule ^ - [L]
28+
# Rewrite everything else to index.html to allow html5 state links
29+
RewriteRule ^ index.php [L]
2830

29-
# Rewrite everything else to index.html to allow html5 state links
30-
RewriteRule ^ index.php [L]
31-
</IfModule>
3231

3332
# CACHING
3433

3534
# Set max-age one year in the future for all static assets
36-
<IfModule mod_headers.c>
37-
# Allow caching for all assets
38-
<FilesMatch "(.*)\.(js|css|png|jpg|html)$">
39-
Header set Cache-Control "max-age=29030400, public"
40-
Header unset ETag
41-
FileETag None
42-
</FilesMatch>
43-
</IfModule>
44-
45-
# Cache Everything, set their expiration date one year in the future
46-
<IfModule mod_expires.c>
35+
# Allow caching for all assets
36+
<FilesMatch "\.(js|css|png|jpg|html)$">
37+
Header set Cache-Control "max-age=29030400, public"
38+
Header unset ETag
39+
FileETag None
4740
ExpiresActive On
48-
ExpiresDefault A300
49-
ExpiresByType image/x-icon A29030400
50-
ExpiresByType application/javascript A29030400
51-
ExpiresByType text/css A29030400
52-
ExpiresByType image/gif A29030400
53-
ExpiresByType image/png A29030400
54-
ExpiresByType image/jpeg A29030400
55-
ExpiresByType text/plain A29030400
56-
ExpiresByType text/html A29030400
57-
</IfModule>
41+
ExpiresDefault A29030400
42+
</FilesMatch>

gulpfile.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -167,7 +167,7 @@ gulp.task('clean', function() {
167167
});
168168

169169
gulp.task('cleanAll', function() {
170-
return gulp.src(assetsRoot.dest, {read: false})
170+
return gulp.src([assetsRoot.dest + '/*', '!'+ assetsRoot.dest +'.gitkeep'], {read: false})
171171
.pipe(clean());
172172
});
173173

0 commit comments

Comments
 (0)