views:

154

answers:

1

The solution to a previous question (How to implement “Maintenance Mode” on already established website), was to use a modified .htaccess to deny IP addresses.

What is the best way to use a web interface to modify an .htaccess file? What I want is a way for an admin to log in to the admin area and switch Maintenance Mode on and off using a basic html form.

I'm using PHP and I'm already using an .htaccess file for a handful of ReWriting.

+6  A: 

How about having two .htaccess files. One called .htaccess.maintenance and the other .htacces.standard.

Whenever you want to switch to maintenance mode copy the one you need over the existing .htaccess.

Do not write a script that touches the .htaccess directly if you don't absolutely have to!

André Hoffmann
This sounds like a great simple solution that I hadn't thought of. Thanks!
justinl
You're welcome.
André Hoffmann