I have a rule set up in .htaccess
to add a trailing slash, but if the host is https
, this causes it to redirect via http
, but I don't understand why:
# add trailing slash
RewriteCond %{REQUEST_URI} ^\/([A-Za-z0-9\-\/]*[A-Za-z0-9\-]+)$
RewriteRule .* /%1/ [R=301,L]
So, if I request https://www.example.com/some/page
it triggers the rule in .htaccess
to add the trailing slash, but redirects me to http://www.example.com/some/page/
.
If a page is requested as https://www.example.com/some/page, why is the rule above redirecting it to http://www.example.com/some/page/?
How can I add the trailing slash while still redirecting with the correct host?