In this example we will redirect http://example.com to https://example.com/mywebsite

Open /etc/apache2/sites-available and find:

DocumentRoot /var/www/html

We will comment this out like so:

#DocumentRoot /var/www/html

Under that add line add:

RedirectPermanenet / https://example.com/mywebsite

Save the file and restart Apache:

systemctl restart apache2

If you want to redirect https then do the same thing in /etc/apache2/sites-available/default-ssl.conf