An elegant way to make a site temporarily unavailable?

Do you know an elegant way to make a site temporarily unavailable? Any configuration or settings for this?

+8
asp.net-mvc-3
source share
2 answers

In IIS you can put app_offline.htm

http://weblogs.asp.net/scottgu/archive/2005/10/06/426755.aspx

On other web servers, check the manual or use a script to rename the index into the backup name, and then rename the offline page to the index and vice versa ...

You can also create an โ€œinactiveโ€ file, the โ€œinactiveโ€ file will be checked for presence when the pages load. If the content is found, you can abort the logic.

eg. in php you would include the following line (via include inter alia)

<?php if(file_exists('/path/to/OffLine.file')) die('The Application is currently Offline! Please try again in a few minutes...'); ?> 

If you want this @ at the mailbox level, you would add a function to PHP.ini ... see http://uk.php.net/manual/en/ini.core.php#ini.auto-prepend- file

To install PHP.ini on the site, see https://serverfault.com/questions/34078/how-do-i-set-up-per-site-php-ini-files-on-a-lamp-server- using-namevirtualhosts

The same is obvious in other languages.

I have a specific script that makes some corrections and actually creates this file for me ... see the custom file app_offline.htm at the time of publication

+7
source share

Actually, there is a mechanism that has already done this, out of the box. You can find a message about this here .

Basically, you should include App_Offline.htm in the root directory of your site, and IIS will delete the site until this file is deleted.

+4
source share

All Articles