Combine multiple 301 redirects

I need to combine multiple redirects via my .htaccess in WordPress for future site migration and re-launch:

  • Domain change
  • Force HTTPS
  • Force www
  • URL structure changes (important to keep juice here)

I’m wondering if there’s any order this is preferably done? Page to page redirects before or after domain and HTTPS+www? Does it matter? And is the below code correct?

RewriteEngine On  # Force HTTPS, WWW URLs, and change of domain RewriteCond %{HTTP_HOST} ^(www\.)?olddomain\.com$   [NC] RewriteRule ^ https://www.newdomain.com%{REQUEST_URI} [L,NE,R=301]  RewriteCond %{HTTPS} off RewriteRule ^ https://%{HTTP_HOST}%{REQUEST_URI} [L,NE,R=301]  ## 301 Redirects # Page to Page Redirect 301 pages/page-name https://www.newdomain.com/page-name Redirect 301 collections/products/product-1 https://www.newdomain.com/product/product-1  # BEGIN WordPress  RewriteEngine On RewriteRule .* - [E=HTTP_AUTHORIZATION:%{HTTP:Authorization}] RewriteBase / RewriteRule ^index\.php$   - [L] RewriteCond %{REQUEST_FILENAME} !-f RewriteCond %{REQUEST_FILENAME} !-d RewriteRule . /index.php [L]  # END WordPress