Skip to content

Instantly share code, notes, and snippets.

@gerasimua
Last active August 29, 2015 14:05
Show Gist options
  • Save gerasimua/3ac8da5fc9f8348d4763 to your computer and use it in GitHub Desktop.
Save gerasimua/3ac8da5fc9f8348d4763 to your computer and use it in GitHub Desktop.
Maintenance with exceptions by IP
SetEnv APPLICATION_ENV development
Options +FollowSymlinks
Options -Indexes
<IfModule mod_rewrite.c>
RewriteBase /
RewriteEngine On
RewriteCond %{REMOTE_ADDR} !=0.0.0.0
RewriteCond %{REQUEST_URI} !^/maintenance\.html$
RewriteRule ^(.*)$ maintenance.html [R=307,L]
# protect source code
RewriteRule ^(.*/)*\.svn/ / [F,L]
# loop stopping
RewriteCond %{ENV:REDIRECT_STATUS} 200
RewriteRule .* - [L]
RewriteCond %{REQUEST_FILENAME} -s [OR]
RewriteCond %{REQUEST_FILENAME} -l [OR]
RewriteCond %{REQUEST_FILENAME} -d [OR]
RewriteCond %{REQUEST_URI} ^/(captcha|css|img|js|modules|uploads) [OR]
RewriteCond %{REQUEST_URI} \.(jpe?g|png|gif|ico|js|css)$
RewriteRule ^.*$ - [NC,L]
RewriteRule ^.*$ index.php [NC,L]
</IfModule>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment