The goal
If the request is http://⋯/.htaccess,
do not display the content of that file,
show an ErrorDocument 403 instead,
rewriting only http:// to https://.
The problem
The URL is rewritten to https://⋯/403.shtml,
instead of the desired https://⋯/.htaccess.
The details
The ErrorDocument 403 and the protection of the
.htaccess are set up by the web hosting provider.
The HTTPS rewrite is set up in the .htaccess file:
RewriteEngine on
RewriteCond %{HTTPS} !on
RewriteRule .* https://%{HTTP_HOST}/$0 [L,QSA,R=301]
Set the following in your
.htaccessfile to reset the default 403 ApacheErrorDocument:It looks like the host has configured the
ErrorDocumentdirective with an absolute URL to the403.shtmldocument, which will naturally trigger a 302 redirect instead of an internal subrequest.