Catalogue
Allow Site Access Only From the Office Wi-Fi IP During Maintenance

Allow Site Access Only From the Office Wi-Fi IP During Maintenance

🌐 日本語で読む

Just a memo.

This post summarizes the procedure for putting a site into maintenance.

Procedure

maintenance.html

Place maintenance.html under the DocumentRoot.

Restrict access with .htaccess

1
2
3
4
5
6
7
8
9
10
11
12
ErrorDocument 503 /maintenance.html

<IfModule mod_rewrite.c>
RewriteEngine On
RewriteCond %{REQUEST_URI} !^.*\.(js|css|gif|jpg|png|ico)$
RewriteCond %{REQUEST_URI} !^/cron/.*$
RewriteCond %{REQUEST_URI} !=/maintenance.html
# 社内
RewriteCond %{REMOTE_ADDR} !=<社内Wifi IP>
RewriteCond %{REMOTE_ADDR} !=<社内Wifi IP>
RewriteRule ^.*$ - [R=503,L]
</IfModule>

That’s all.

kenzo0107

kenzo0107