Welcome to Geeklog, Anonymous Thursday, December 04 2025 @ 03:56 pm EST
Geeklog Forums
[Tip] Using .htaccess to enable maintenance mode with IP whitelist during migration
Status: offline
ivywe
Forum User
Newbie
Registered: 08/14/25
Posts: 12
Here is a useful .htaccess example for site administrators performing a migration.
With this configuration:
General visitors are redirected to a maintenance page.
Only requests from whitelisted IP addresses can access the site normally.
I used the following .htaccess configuration when migrating my Geeklog site, and it worked well, so I’m sharing it here.
With this setup:
General visitors are redirected to a maintenance page.
Only requests from whitelisted IP addresses can access the site normally.
The maintenance page itself remains accessible.
The example below includes English comments and uses documentation-safe IP ranges (RFC5737). You can replace them with your own allowed IPs.
RewriteEngine On
# --- Redirect a specific URL to the site root ---
RewriteCond %{THE_REQUEST} \s/index\.php/topic/home_ja[\s?]
RewriteRule ^index\.php/topic/home_ja$ / [R=301,L]
# --- Whitelisted IP addresses (regex format) ---
RewriteCond %{REMOTE_ADDR} ^203\.0\.113\.10$ [OR]
RewriteCond %{REMOTE_ADDR} ^203\.0\.113\.25$ [OR]
RewriteCond %{REMOTE_ADDR} ^198\.51\.100\.45$ [OR]
RewriteCond %{REMOTE_ADDR} ^198\.51\.100\.99$ [OR]
RewriteCond %{REMOTE_ADDR} ^192\.0\.2\.123$ [OR]
RewriteCond %{REMOTE_ADDR} ^192\.0\.2\.77$ [OR]
RewriteCond %{REMOTE_ADDR} ^203\.0\.113\.88$ [OR]
RewriteCond %{REMOTE_ADDR} ^203\.0\.113\.200$
# → If the client IP matches one of the above, allow normal site access
RewriteRule ^ - [L]
# --- Exception: Allow direct access to the maintenance page itself ---
RewriteCond %{REQUEST_URI} !^/\.maintenance
# --- For all other IPs, redirect to the maintenance page ---
RewriteRule ^.*$ /.maintenance/index.html [L]
With this configuration:
General visitors are redirected to a maintenance page.
Only requests from whitelisted IP addresses can access the site normally.
I used the following .htaccess configuration when migrating my Geeklog site, and it worked well, so I’m sharing it here.
With this setup:
General visitors are redirected to a maintenance page.
Only requests from whitelisted IP addresses can access the site normally.
The maintenance page itself remains accessible.
The example below includes English comments and uses documentation-safe IP ranges (RFC5737). You can replace them with your own allowed IPs.
Text Formatted Code
# During the migration phase, general users will be redirected to a maintenance pageRewriteEngine On
# --- Redirect a specific URL to the site root ---
RewriteCond %{THE_REQUEST} \s/index\.php/topic/home_ja[\s?]
RewriteRule ^index\.php/topic/home_ja$ / [R=301,L]
# --- Whitelisted IP addresses (regex format) ---
RewriteCond %{REMOTE_ADDR} ^203\.0\.113\.10$ [OR]
RewriteCond %{REMOTE_ADDR} ^203\.0\.113\.25$ [OR]
RewriteCond %{REMOTE_ADDR} ^198\.51\.100\.45$ [OR]
RewriteCond %{REMOTE_ADDR} ^198\.51\.100\.99$ [OR]
RewriteCond %{REMOTE_ADDR} ^192\.0\.2\.123$ [OR]
RewriteCond %{REMOTE_ADDR} ^192\.0\.2\.77$ [OR]
RewriteCond %{REMOTE_ADDR} ^203\.0\.113\.88$ [OR]
RewriteCond %{REMOTE_ADDR} ^203\.0\.113\.200$
# → If the client IP matches one of the above, allow normal site access
RewriteRule ^ - [L]
# --- Exception: Allow direct access to the maintenance page itself ---
RewriteCond %{REQUEST_URI} !^/\.maintenance
# --- For all other IPs, redirect to the maintenance page ---
RewriteRule ^.*$ /.maintenance/index.html [L]
14
12
Quote
All times are EST. The time is now 03:56 pm.
- Normal Topic
- Sticky Topic
- Locked Topic
- New Post
- Sticky Topic W/ New Post
- Locked Topic W/ New Post
- View Anonymous Posts
- Able to post
- Filtered HTML Allowed
- Censored Content