85 lines
3.1 KiB
ApacheConf
85 lines
3.1 KiB
ApacheConf
<IfModule mod_deflate.c>
|
|
# Enable on-the-fly compression for various file types.
|
|
AddOutputFilterByType DEFLATE application/javascript
|
|
AddOutputFilterByType DEFLATE application/rss+xml
|
|
AddOutputFilterByType DEFLATE application/vnd.ms-fontobject
|
|
AddOutputFilterByType DEFLATE application/x-font
|
|
AddOutputFilterByType DEFLATE application/x-font-opentype
|
|
AddOutputFilterByType DEFLATE application/x-font-otf
|
|
AddOutputFilterByType DEFLATE application/x-font-truetype
|
|
AddOutputFilterByType DEFLATE application/x-font-ttf
|
|
AddOutputFilterByType DEFLATE application/x-javascript
|
|
AddOutputFilterByType DEFLATE application/xhtml+xml
|
|
AddOutputFilterByType DEFLATE application/xml
|
|
AddOutputFilterByType DEFLATE font/opentype
|
|
AddOutputFilterByType DEFLATE font/otf
|
|
AddOutputFilterByType DEFLATE font/ttf
|
|
AddOutputFilterByType DEFLATE image/svg+xml
|
|
AddOutputFilterByType DEFLATE image/x-icon
|
|
AddOutputFilterByType DEFLATE text/css
|
|
AddOutputFilterByType DEFLATE text/html
|
|
AddOutputFilterByType DEFLATE text/javascript
|
|
AddOutputFilterByType DEFLATE text/plain
|
|
AddOutputFilterByType DEFLATE text/xml
|
|
|
|
# Remove browser bugs (only needed for really old browsers)
|
|
BrowserMatch ^Mozilla/4 gzip-only-text/html
|
|
BrowserMatch ^Mozilla/4\.0[678] no-gzip
|
|
BrowserMatch \bMSIE !no-gzip !gzip-only-text/html
|
|
Header append Vary User-Agent
|
|
</IfModule>
|
|
|
|
<IfModule mod_expires.c>
|
|
ExpiresActive On
|
|
|
|
# Cache for 1 month by default
|
|
ExpiresDefault "access plus 1 month"
|
|
|
|
ExpiresByType text/css "access plus 1 year"
|
|
ExpiresByType application/javascript "access plus 1 year"
|
|
ExpiresByType image/gif "access plus 1 month"
|
|
ExpiresByType image/png "access plus 1 month"
|
|
ExpiresByType image/jpeg "access plus 1 month"
|
|
ExpiresByType image/svg+xml "access plus 1 month"
|
|
ExpiresByType image/x-icon "access plus 1 month"
|
|
</IfModule>
|
|
|
|
<IfModule mod_rewrite.c>
|
|
<IfModule mod_negotiation.c>
|
|
Options -MultiViews -Indexes
|
|
</IfModule>
|
|
|
|
RewriteEngine On
|
|
|
|
# Block access to .git directory
|
|
RewriteRule .*\.git/.* - [L,R=404]
|
|
|
|
# Force HTTPS and www subdomain
|
|
RewriteCond %{HTTPS} off [OR]
|
|
RewriteCond %{HTTP_HOST} !^www\. [NC]
|
|
RewriteRule ^ https://www.stemmechanics.com.au%{REQUEST_URI} [L,R=301]
|
|
|
|
# Handle Authorization Header
|
|
RewriteCond %{HTTP:Authorization} .
|
|
RewriteRule .* - [E=HTTP_AUTHORIZATION:%{HTTP:Authorization}]
|
|
|
|
# Redirect Trailing Slashes If Not A Folder...
|
|
RewriteCond %{REQUEST_FILENAME} !-d
|
|
RewriteCond %{REQUEST_URI} (.+)/$
|
|
RewriteRule ^ %1 [L,R=301]
|
|
|
|
# Serve pre-compressed files
|
|
RewriteCond %{HTTP:Accept-encoding} gzip
|
|
RewriteCond %{REQUEST_FILENAME}\.gz -s
|
|
RewriteRule ^(.+)\.(css|js)$ $1.$2.gz [QSA]
|
|
|
|
# Serve correct content types for pre-compressed files.
|
|
RewriteRule \.css\.gz$ - [T=text/css,E=no-gzip:1]
|
|
RewriteRule \.js\.gz$ - [T=text/javascript,E=no-gzip:1]
|
|
|
|
# Send Requests To Front Controller...
|
|
RewriteCond %{REQUEST_FILENAME} !-d
|
|
RewriteCond %{REQUEST_FILENAME} !-f
|
|
RewriteRule ^ index.php [L]
|
|
</IfModule>
|