Apache – Time based redirections

In this tutorial we are using the Apache HTTPD server on SUSE Linux and we use the example of wanting to display a different support page when the support desk is open to when it is closed. This can be achieved using the rewrite module in apache.

In SUSE we enable the module in /etc/sysconfig/apache2, we add rewrite to the MODULES lines. With that in lace we can then add the conditions and rules that we need.

We have two support pages a day pay that has the live support chat and an out of out or night page that does not have the chat support. In out case the pages are called supportday.html and supportnight.html. As we access the support.html we will be redirected to one of these pages based on the time of day.

Within the httpd.conf, on SUSE we use the default-server-conf I add these lines