Skip to content

Instantly share code, notes, and snippets.

@janus57
Last active August 29, 2015 14:17
Show Gist options
  • Select an option

  • Save janus57/f04f9bfb4d6245a8c7a5 to your computer and use it in GitHub Desktop.

Select an option

Save janus57/f04f9bfb4d6245a8c7a5 to your computer and use it in GitHub Desktop.
Simple .htaccess for maintenance page
ErrorDocument 503 /maintenance.php
RewriteEngine On
#RewriteCond %{REMOTE_ADDR} !^111\.222\.333\.444$ #to ignore IP
RewriteCond %{REQUEST_URI} !\.(png|jpg)$ #you can add other extension like JS or whatever (to exclude the 503)
RewriteCond %{REQUEST_URI} !/maintenance.php$ #excluding the maintenance page itself
RewriteRule .* - [R=503,L]
#other possibilitie, but i don't know if it's SEO "compliant"
ErrorDocument 503 /maintenance.php
RewriteEngine On
#RewriteCond %{REMOTE_ADDR} !^111\.222\.333\.444$ #to ignore IP
RewriteCond %{REQUEST_URI} !\.(png|jpg)$ #you can add other extension like JS or whatever (to exclude the 503)
RewriteCond %{REQUEST_URI} !/maintenance.php$ #excluding the maintenance page itself
RewriteRule .* /maintenance.php [L,R=307]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment