Redirect all but my IP using mod_rewrite

(Command updated Dec 21, 2006 due to issues with Firefox not liking previous method)

Just testing some things on a server I run and wanted to find a way to redirect everyone but myself to a holding page (or another URL). This can be done with mod_rewrite and either set in an .htaccess file or, in my case, your httpd.conf file. Here is the code you'd need:

RewriteCond %{REMOTE_ADDR} !^12\.34\.56\.78$
RewriteRule .* /down.html

Where xxx.xx etc. represents your IP address and is the URL or file you wish anyone not at xxx.xx to be redirected to. As ever I hope this helps anyone else like myself who spent a good half hour or so looking for a solution. Credit goes to final post in this thread.



YUM - Repository base is listed more than once

PayPal UK telephone number

"PC Not Listed" XBox 360 - Solution

Including random number (timestamp) in vBulletin

Hiding Thunderbird "Sending Messages" dialogue