15.Emergency Offline Mode

15.Emergency Offline Mode

Emergency Offline mode uses .htaccess rules to redirect all visitors to a static offline.html page, except for a single allowed IP address. This works on Apache and Litespeed servers only.

15.1.Enable offline mode

Usage:

wp admintools offline enable <ip>

Backs up the current .htaccess file and replaces it with rules that redirect all visitors to a static offline.html page, except for the specified allowed IP address.

<ip>

Required. The IP address to allow access while offline. Since WP-CLI runs on the server itself, you must provide your public IP address so you can still reach the site from your browser.

Example:

wp admintools offline enable 203.0.113.50
Success: Emergency Offline mode enabled. Only 203.0.113.50 can access the site.