To whom it may concern,
there are various packages that could do what you want. But there is also a possibility to write a script for it.
But further details are needed. What www server do you have (apache, nginx, and so on) and some other parameters.
I am at your disposal for further questions.
Regards,
Daniel