Options -Indexes
RewriteEngine On
RewriteCond %{HTTPS} off
RewriteCond %{HTTP_HOST} !^(localhost|127\.0\.0\.1):8080$ [NC]
# Do not redirect to https when request is CDN cloudflare (Edge Server to Origin Server)
RewriteCond %{HTTP:X-Forwarded-Proto} !https [NC]
# Do not redirect to https when request is CDN parspack (Edge Server to Origin Server)
RewriteCond %{HTTP:X-Url-Scheme} !^\s*:?\s*https\s*$ [NC]
RewriteRule ^ https://%{HTTP_HOST}%{REQUEST_URI} [L,R=301]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . index.php [L]