Skip to main content
Inspiring
August 7, 2007
Question

What is the best way to disable a website for maintenance?

  • August 7, 2007
  • 1 reply
  • 552 views
I'm thinking of building a button inot my admin section of my site that when pushed would set an application variable or something to send people to a different splash screen when they log in that will tell them the site is down for maintenance. Any ideas on what the best way to do this would be? Does anyone know of any example apps out there I could look at?

Thanks!
This topic has been closed for replies.

1 reply

Inspiring
August 7, 2007
I use Application.cfm to check my database settings.

So you have a cfquery tag retrieve the settings, check if maintenance is 1, If so, you can do one of two things
1 is redirect using cflocation to maintenance.cfm and exit processing the file.
2 is to include maintenance.cfm and have maintenance.cfm exit processing the file
Inspiring
August 7, 2007
The cool thing about this code here is the use of a debug mode cookie. If the cookie is set with the secret key, then that person can still view the website. You have a form in the back end that sets up the cookie with the same key. So when you are ready for maintenance, you can shut down the website, enable the machine you are using to have debug mode enabled and debug any changes without them being visible to the public.

This even works when you are not in maintenance.

Say you are working on a new section of code, you can put it into a separate file (in case of syntax errors) and then only include the file if the debug mode is enabled.

Great if you are changing an entire section such as your header, or main template even, but you still want everyone else to see the old one until you are finished.
siriivenAuthor
Inspiring
August 7, 2007
Thanks guys. I will check these ideas out!