Skip to content

Commit

Permalink
feat: htaccess support added
Browse files Browse the repository at this point in the history
  • Loading branch information
soumyadip007 authored Oct 14, 2024
1 parent 8b4d464 commit 9af9d90
Showing 1 changed file with 48 additions and 0 deletions.
48 changes: 48 additions & 0 deletions .htaccess
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule (.*) index.html
Header set X-Spaship-Single "true"
</IfModule>
<IfModule mod_include.c>
SSILastModified on
</IfModule>

ExpiresActive On

# Add caching for data without extension
ExpiresByType image/png M604800

ExpiresByType image/jpeg M604800

# Caching for 1 YEAR (favicon)
<filesMatch "\.(ico)$">
Header set Cache-Control "max-age=29030400, public"
</filesMatch>

# Caching for 1 WEEK (images)
<filesMatch "\.(jpg|jpeg|png|gif|svg)$">
Header set Cache-Control "max-age=604800, public"
</filesMatch>

# Caching for 3 HOUR (js/css)
<filesMatch "\.(js|css)$">
Header set Cache-Control "max-age=604800, public"
</filesMatch>

# Caching for 1 HOURS (html) with revalidation
<FilesMatch "\.(html)$">
Header set Cache-Control "max-age=3600, s-max-age=3600, public, no-cache"
</FilesMatch>

# Enable Gzip compression
<IfModule mod_deflate.c>
# Compress HTML, CSS, JavaScript
AddOutputFilterByType DEFLATE text/html text/css application/x-javascript application/javascript
</IfModule>

# Ensure .mjs files are served with the correct MIME type
<IfModule mod_mime.c>
AddType application/javascript .mjs
</IfModule>

0 comments on commit 9af9d90

Please sign in to comment.