Although the other answer is not wrong (I didn’t test it), I think that is a bit harder to understand. Instead of writing it there, do it in your apache virtual hosts (mine is in /etc/apache2/sites-available/000-default.conf).
The top one has all your default stuffs:
I placed it all in the same file since all it does is redirect. Make sure you add one to also resolve your IP. Hope this is helpful since its the second search result on google.