избавляемся от двойного редиректа


DirectorySlash Off

# Allow mod_rewrite to function when there is no trailing slash
RewriteOptions AllowNoSlash

RewriteEngine On
RewriteCond %{REQUEST_FILENAME} -d
RewriteCond %{REQUEST_URI} !(.*)/$
# RewriteRule ^(.*)$ $1/ [L,R=301]
RewriteRule ^(.*)$ https://%{HTTP_HOST}%{REQUEST_URI}/ [L,R=301]

Когда нужно закрыть или открыть доступ только к некоторым мельти доменам


.htaccess:

SetEnvIfNoCase Host s4\.yandex\.ru$ require_auth=true
SetEnvIfNoCase Host s54\.yandex\.ru$ require_auth=true

AuthType Basic
AuthName «Access to the staging site»
AuthUserFile /data/www/yandex.ru/.htpasswd
Require valid-user

# Setup a deny/allow
Order Deny,Allow
# Deny from everyone
Deny from all
# except if either of these are satisfied
Satisfy any
# 1. a valid authenticated user
Require valid-user
# or 2. the «require_auth» var is NOT set
#Allow from env=!require_auth
Allow from env=require_auth