Hello there,
Actually, I think this article could really help you! https://www.danielmorell.com/guides/htaccess-seo/https-www-and-trailing-slash
Alternatively, if you want to get the rules right away, just copy below, change the "example.com" to your domain then it should be working.
Force HTTPS
Force WWW
Remove trailing / from file
Turn on rewrite engine
RewriteEngine on
Check if not directory and ends in /
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_URI} (.+)/$
If not a directory skip next RewriteRule
RewriteRule ^ - [S=2]
Check if HTTPS and WWW
RewriteCond %{HTTP_HOST} !^www.(.*)$ [OR,NC]
RewriteCond %{https} off
This RewriteRule skipped if URI was a directory
RewriteRule ^(.*)$ https://www.example.com/$1 [R=301,L]
This RewriteRule used if URI was a directory
RewriteCond %{REQUEST_FILENAME} -d
RewriteRule ^ - [S=1]
RewriteRule ^(.*)/$ https://www.example.com/$1 [R=301,L]
Do note, this 301 redirect your URL to the version with trailing slash, and because Google sees the trailing slash and non-trailing slash version of your pages as a different page, you should be doing a 301 to the right one. Read more about it here: https://www.seroundtable.com/google-trailing-slashes-url-24943.html
Of course, you can choose to remove the trailing slash 301 redirecting, Moz doesn't redirect to either version, and they rank well. But sites like Neilpatel (they have unnecessary redirects) and Backlinko does redirect, and they rank well too. So it's up to you if you want Google to help you identify which version you prefer or you tell Google yourself.
Finally, you can use this tool to check if your redirects are working as you expected: https://httpstatus.io/ (When you test, use a blog page or a specific page to test all the 8 variations because trailing slash doesn't matter at the homepage, take a look at screenshots below)
uPeMS8X.jpg ugDMJZ9.jpg 0wtlmAX.jpg HV2Byd5.jpg