Skip to content

Instantly share code, notes, and snippets.

@bmunslow
Last active March 28, 2017 07:06
Show Gist options
  • Save bmunslow/a032080627e0230cfd8c to your computer and use it in GitHub Desktop.
Save bmunslow/a032080627e0230cfd8c to your computer and use it in GitHub Desktop.
Custom .htaccess maintenance mode
<IfModule mod_rewrite.c>
RewriteEngine on
# Customize specific IP address which should have access to the live site
RewriteCond %{REMOTE_ADDR} !^11\.22\.33\.44
# Customize name of your maintenance mode template file
RewriteCond %{REQUEST_URI} !/maintenance.html$ [NC]
# Only images and CSS files are allowed. Customize to allow Javascript or other image extensions
RewriteCond %{REQUEST_URI} !\.(jpe?g?|png|gif|css) [NC]
# Customize name of your maintenance mode template file
RewriteRule .* /maintenance.html [R=302,L,E=nocache:1]
# Set the response header if the "nocache" environment variable is set in the RewriteRule above.
Header always set Cache-Control "no-store, no-cache, must-revalidate" env=nocache
Header always set Expires "Thu, 01 Jan 1970 00:00:00 GMT" env=nocache
</IfModule>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment