Skip to content

Instantly share code, notes, and snippets.

@PJZ9n
Created May 10, 2020 10:47
Show Gist options
  • Save PJZ9n/84c7a5832afdd6f1a787a75e7998053b to your computer and use it in GitHub Desktop.
Save PJZ9n/84c7a5832afdd6f1a787a75e7998053b to your computer and use it in GitHub Desktop.
条件付きアクセス拒否
ErrorDocument 404 /error/404.php
ErrorDocument 503 /error/503.php
<IfModule mod_rewrite.c>
RewriteEngine on
RewriteCond %{REQUEST_URI} !^/error/.*$
RewriteCond %{REQUEST_FILENAME} !\.(css|js|png|ico)$
# 好きなIP指定する
RewriteCond %{REMOTE_ADDR} !^192.168.0.0$
RewriteRule ^.*$ - [R=503,L]
</IfModule>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment