PHP Enabled Websites Not Directed Correctly

I think I found a workaround to rewrite the redirected page.

Here’s how the apache configuration for my site turned out. I’m not sure if it’s elegant, but it did work. Any comments to better it would be more than welcome.

<VirtualHost *:80>
    ServerName mysite.com
    Redirect / https://mysite.com

</VirtualHost>
<VirtualHost *:443>
    ServerName mysite.com
    DocumentRoot /var/www/mysite.com/public_html

    <Directory /var/www/mysite.com/public_html>
        <IfModule mod_rewrite.c>
            RewriteEngine On
            RewriteRule ^/index.php/(.*)$ /$1 [R,L]
            RewriteCond %{REQUEST_FILENAME} !-f
            RewriteCond %{REQUEST_FILENAME} !-d
            RewriteRule ^(.*)$ index.php [L]
        </IfModule>
    </Directory>
 
    <Directory /var/www/mysite.com/public_html>
        Options -Indexes +FollowSymLinks
        AllowOverride All
    </Directory>

    ErrorLog ${APACHE_LOG_DIR}/mysite.com-error.log
    CustomLog ${APACHE_LOG_DIR}/mysite.com-access.log combined

SSLCertificateFile /etc/letsencrypt/live/mysite.com/fullchain.pem
SSLCertificateKeyFile /etc/letsencrypt/live/mysite.com/privkey.pem

</VirtualHost>