Created
May 29, 2016 16:48
-
-
Save jcamachott/f9c5b3261f701b8d8281bfb60ae430b5 to your computer and use it in GitHub Desktop.
htaccess maintenance mode with IP exceptions
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
RewriteEngine On | |
RewriteBase / | |
# Add all the IP addresses of people that are helping in development | |
# and need to be able to get past the maintenance mode. | |
# One might call this the 'allow people list' | |
RewriteCond %{REMOTE_HOST} !^77\.234\.42\.555 | |
RewriteCond %{REMOTE_HOST} !^190\.213\.189\.555 | |
# This is the 'ignore file list'. It allows access to all | |
# files that are needed to display the maintenance mode page. | |
# Example: pages, css files, js files, images, anything. | |
# IMPORTANT: If you don't do this properly, visitors will end up with | |
# endless redirect loops in their browser. | |
RewriteCond %{REQUEST_URI} !/temp\.html$ | |
RewriteCond %{REQUEST_URI} !/assets\/img\/cariecom-logo\.png$ | |
RewriteCond %{REQUEST_URI} !/assets\/js\/jquery\.countdown\.min\.js$ | |
# Rewrite whatever request is coming in to the maintenance mode page | |
# The R=302 tells browsers (and search engines) that this | |
# redirect is only temporarily. | |
# L stops any other rules below this from executing whenever somebody is redirected. | |
RewriteRule \.*$ /temp.html [R=302,L] | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment