Forked from anonymous/gist:c3066c657c453c09a48deb1ed8b5d12f
Created
March 5, 2018 19:08
-
-
Save garthhumphreys/8fe0308ed12cca1816a4ba3fb88da255 to your computer and use it in GitHub Desktop.
.htacess/httpd.conf maintenance mode changes
This file contains 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 | |
# If this file (toggle file) exsists then put the site into maintenance mode | |
RewriteCond /path/to/where/your/toggle/file/is/located/on/the/server -f | |
# If coming from approved ip address, then don't put it into maintenance mode, | |
# here I'm using HTTP:x-forwarded-for in place of REMOTE_ADDR this is because some users (or your yourself) might | |
# arrive to the site via a proxy server, so it's more accurate to use HTTP:x-forwarded-for to get the real ip address, | |
# Also please note that the ip address below has '\' in them because HTTP:x-forwarded-for returns or stores the ip address as a comma delimited list | |
RewriteCond %{HTTP:x-forwarded-for} !^127\.127\.127\.127$ | |
# redirect to the maintenance mode page | |
RewriteRule ^(.+) /path/to/the/maintenance/mode/directory/or/index.html/$1 [L] |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment