My answers a little verbose but since the redirects in htaccess are done once and then forgotten about and these needed to be in one place ... you got a verbose answer.
The 404 error document does not redirect the browser to the 404 page.
# when a 404 error happens gives message Oops! We Can't find that file sorry.
ErrorDocument 404 "Oops! We can't find that file Sorry."
# read a file and present it as the 404 page, can be a 404.php page
ErrorDocument 404 /404.html
The advantage to a 404.php file is you may log information about the error not available in the log file. Or the 404.php could look at the URL and suggest an alternative; Because the 404.php is running as if it is the 404 page. One could build a CMS system under the 404 error which would work but look like everything is a page not found, the web-bots would hate you.
Dealing with sending the 301 from the server to the browser is also confusing because the browser caches the last 301 so when you change it the browser may continue to do what it did last time.
use Google, Developer tools > Network tab > disable caching check box ... in the window and tab that you are using to check. A different window or tab may still cache.
First take care of http to https
The rule for going from a http to https is straight forward.
RewriteEngine On
RewriteCond %{SERVER_PORT} ^80$
RewriteRule ^(.*)$ "https://example.com/$1" [R=301,L]
I'm checking the port number as I've double checked this on my sandbox system ... Port 80 is http, I've http connections on ports 80 and 8080 on my sandbox.
Since we don't want https://www.example.com I'm sending the traffic to https://example.com
If we want to combine the http to https with the removal of index.html or index.ht(anything IE wild card).
We will need two sets of Rewrite conditions. And because it is pre-processed by apache the rewriteRule becomes estranged. It can be done but it may be needlessly complex if we do not have links to http://www.example.com/c/index.html and want to use our full budget given by the browser as three redirects ... I tend away from linking to an index.html so I can keep things simple.
RewriteEngine On
# redirect http(.*)index.html to https://example.com
# or http://www.example.com/index.html to https://example.com/
# and http://example.com/c/index.html to https://example.com/c/
# NOTE !!! this only redirects if an index.html or index.htm exists.
RewriteCond %{SERVER_PORT} ^80$
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} -f
RewriteRule (.*)index\.ht(.*)$ https://example.com/$1 [L,R=301]
# Note for above line
# the first (.*) is $1 everything between host and index.ht??
# the second (.*) is $2 and we don't need to use it
# the redirect is to http://example.com/[first (.*) is our directory]
# OK its not an index.html so send we need to redirect non index.ht?? as well.
RewriteCond %{SERVER_PORT} ^80$
RewriteRule ^(.*)$ "https://example/$1" [R=301,L]
The normal Apache file setup is to have one directory for ssl and another for html. The above .htaccess is for sending the html to the SSL. So the above .htaccess can go in the root of the html folder. There are two .conf in etc/apache2/sites-enabled/ one for port 80 and the other for port 443 ... which directory each uses is specified there ... on shared hosting a minimum of two per site, and two per subdomain.
Remove index.html and index.htm from https
We already did that above but we don't to check http so
RewriteEngine On
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} -f
RewriteRule (.*)index.ht(.*)$ https://example.com/$1 [L,R=301]
To remove www from https://www.example.com/
RewriteEngine On
RewriteCond %{HTTP_HOST} ^www\.example\.com$ [NC]
RewriteRule ^(.*) http://example.com/$1 [L,R]
These two could be combined as well but first consider how the .htaccess would look if you went ahead and allowed multiple 301s, IE http://www.example.com/index.html redirects to https://example.com/index.html and then again to https://example.com/ not ideal from users point of view but it works.
Here's all the needed redirects in a single file.
RewriteEngine On
# 301 to https
RewriteCond %{SERVER_PORT} ^80$
RewriteRule ^(.*)$ "https://example.com/$1" [R=301,L]
# 301 to example.com not www.example.com
RewriteCond %{HTTP_HOST} ^www\.example\.com$ [NC]
RewriteRule ^(.*) https://example.com/$1 [L,R]
# 301 to remove index.html and index.htm
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} -f
RewriteRule (.*)index\.ht(.*)$ https://example.com/$1 [L,R=301]
# I'm in my budget of 3 with only 2 301 redirects worst case.
ErrorDocument 404 /404.html
# almost forgot disable directory listing.
Options -Indexes