RewriteEngine On

# Force HTTPS and keep current host
RewriteCond %{HTTPS} off
RewriteRule ^ https://%{HTTP_HOST}%{REQUEST_URI} [R=301,L]

# Remove index.php
RewriteCond %{THE_REQUEST} \s/+(.*/)?index\.php[\s?] [NC]
RewriteRule ^(.*/)?index\.php$ /$1 [R=301,L]