When you’re updating a website you often want all urls to point to a maintenance page but still have access yourself.
Sponsored Links:
Using .htaccess & mod_rewrite to Redirect Everyone Except Your IP
You can do this with mod_rewrite and an .htaccess file:
Get mod_rewrite going
Options -MultiViews +FollowSymLinks
RewriteEngine On
# Redirect everyone who's not from your IP
RewriteCond %{REMOTE_ADDR} !123.456.789.10 [NC]
# Allow real files to be served
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule !maintenance.html$ maintenance.html [R=307,L]
Replace 123.456.789.10 with your own IP address