Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Put a website in maintenance mode?

I've developed my first web application which, surprisingly, is getting very popular.

Because the website is now live, I have a hard time doing some changes, in fear some people are still logged in and are using the application.

I wish to avoid having a duplicated instance of the web application for testing.

Is there any way to put the website in 'maintenance mode' with only me having access to it? Like redirecting to a page with some info, telling its in maintenance mode.

Thanks. :-)

like image 662
janhartmann Avatar asked May 26 '09 18:05

janhartmann


2 Answers

I wish to avoid having a duplicated instance of the web application for testing.

That's your problem right there. For anything but the most trivial sites, you should have a staging or development instance. You should be using source control and have a script to update the main instance.

like image 89
jon skulski Avatar answered Oct 29 '22 15:10

jon skulski


You can simply drop a file called app_offline.htm in the root of your website and ASP.NET will automatically route all traffic to this page. This file can contain any HTML you wish indicating that your site is down for a short period due to maintenance.

For more information please read App_Offline.htm and working around the "IE Friendly Errors" feature:

The way app_offline.htm works is that you place this file in the root of the application. When ASP.NET sees it, it will shut-down the app-domain for the application (and not restart it for requests) and instead send back the contents of the app_offline.htm file in response to all new dynamic requests for the application. When you are done updating the site, just delete the file and it will come back online.

like image 24
Andrew Hare Avatar answered Oct 29 '22 13:10

Andrew Hare