RewriteEngine On
# Cache-Control headers
<IfModule mod_headers.c>
# Service Worker script: spec-recommended no-cache so browsers always check
# for updates via conditional request, but can use ETags for 304 responses.
# Must be declared BEFORE the generic .js rule so it takes precedence.
<FilesMatch "^sw\.js$">
Header set Cache-Control "no-cache"
</FilesMatch>
# CSS/JS: Must check with server before using cached copy
<FilesMatch "\.(css|js)$">
Header set Cache-Control "max-age=0, must-revalidate"
</FilesMatch>
</IfModule>
#RewriteCond %{REMOTE_ADDR} !^1\.2\.3\.4
RewriteCond %{DOCUMENT_ROOT}/maint/ -d
#RewriteCond %{SCRIPT_FILENAME} !yourip.php
RewriteCond %{REQUEST_URI} !\.(jpe?g?|png|gif) [NC]
RewriteCond %{DOCUMENT_ROOT}/maintenance.enable -f
RewriteCond %{SCRIPT_FILENAME} !/maint/
RewriteRule ^.*$ /maint/ [R=503,L]
ErrorDocument 503 /maint/
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ index.php [QSA,L]
# Handle trailing slashes
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_URI} (.+)/$
RewriteRule ^ %1 [R=301,L]
# Route everything through index.php
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ index.php [QSA,L]
|