I want to 301 redirect everything to https, www and index.php with .htaccess. I've tried several different combinations of code, but they all force non-www or break. I commented out the https redirect in the code below because it does not work, but I want to show an example of something I tried.
Also, with the code below, https://example.com/example-page works, but when I add a trailing / it redirects to https://example.com.
Thank you for your help.
AddType text/css .css
AddType application/x-httpd-php .php .htm .html
<IfModule mod_rewrite.c>
RewriteEngine On
# RewriteCond %{SERVER_PORT} !^443$
# RewriteRule ^(.*)$ https://%{HTTP_HOST}%{REQUEST_URI} [R=301]
RewriteBase /
RewriteRule ^index\.php$ - [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /index.php [L]
</IfModule>