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>
    Redirect /

<VirtualHost *:443>
    DocumentRoot /var/www/

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

    ErrorLog ${APACHE_LOG_DIR}/
    CustomLog ${APACHE_LOG_DIR}/ combined

SSLCertificateFile /etc/letsencrypt/live/
SSLCertificateKeyFile /etc/letsencrypt/live/