How can I "close" a website on Sundays only

Viewed 213

I am looking for a script that redirects all pages of a website to a page stating that the whole site is closed on Sundays for religious reasons.

It should redirect only on Sunday. On all other days of the week the site should function as normal.

I'd like to do that at the server level in a .htaccess file, or in a PHP script.

I could imagine something like this:

$day = date('w');
if ($day == 0) { // Sunday...
    header("Location: http://www.domain.com/closedonsunday.html");
}
4 Answers
Related