You’ve put the HTTP to HTTPS (and canonical www) redirect in the wrong place. It should go before the WordPress front-controller. In fact, it should go before the # BEGIN WordPress
section to avoid any chance of it being overwritten by WordPress in future updates.
To be honest, I’m a bit surprised that redirect would actually do anything (except for requests to static resources)? (Maybe you are seeing a cached redirect, or maybe WP itself is later redirecting to the home page?)
For example:
RewriteCond %{HTTPS} off [OR]
RewriteCond %{HTTP_HOST} !^www\.
RewriteRule ^ https://www.example.com%{REQUEST_URI} [NE,L,R]
# BEGIN WordPress
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /
RewriteRule ^index\.php$ - [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /index.php [L]
</IfModule>
# END WordPress
That redirect should ultimately be a 301 (permanent) redirect. So change R
to R=301
once you have confirmed it’s working OK.