# Redirect domain during certain time of the week

Please bear with me, I am pretty new to Joomla, and I only have a slightly operational knowledge of web design.

So here's what I want to do; Our church streams our sermons every sunday morning from about 10:30 to about 12:30. I want to redirect all pages under our domain (with the exception of the admin page) to the live stream url. I know it's probably just a matter of throwing together a script, but I lack the proficiency to do so from scratch. If someone could just get me started, I think I could tweak whatever parameters I need to to make it do what I want.

Thanks!

Maybe not the most elegant solution, but you can add the following code to the beginning of your templates index.php file (located in ROOT/templates/YOURTEMPLATE/index.php):

<?php
$hour = date('G');$minute = date('i');
$day = date('w');$m = $hour * 60 +$minute; // Minutes since midnight.
if(
$day == 0 // Sunday... &&$m >= 630 // ... after 10:30…
&& \$m <= 750 // ... but before 12:30…

This should redirect all your visitors to http://example.com every Sunday between 10:30 and 12:30.
• +1 for the answer, however I would recommend making a small plugin for this rather than editing the template's index.php. At least that way no changes will be overridden and it can easily be disable if need be ;) – Lodder May 4 '15 at 17:21