Community

.htaccess allow and deny all other visitors and reroute them to a maintenance page

I want to do some online testing, and run some browsershots. I'd like to write a rule in .htaccess that only a couple of ip's are let through and that all others are sent to a maintenance page.

I understand the allow/ deny part, but I can't find a way to redirect the visitors that have a deny to a maintenance page.

Comments

Solved. The code I looked up

Solved. The code I looked up was wrong. This one does work:

Options +FollowSymlinks
RewriteEngine on
RewriteCond %{REQUEST_URI} !/maintenance.html$
RewriteCond %{REMOTE_HOST} !^888\.888\.888\.888
RewriteRule $ /maintenance.html [R=302,L]

Replace the 888's with your IP address of course.

Source:
http://www.techiecorner.com/97/redirect-to-maintenance-page-during-upgra...

----

Have some spare time? Consider helping, and fixing bugs. :-)