Apache 使用htaccess将具有子域http[s][www]的多个域重定向到https://[subdomains].domain3

Apache 使用htaccess将具有子域http[s][www]的多个域重定向到https://[subdomains].domain3,apache,.htaccess,redirect,mod-rewrite,https,Apache,.htaccess,Redirect,Mod Rewrite,Https,我正在尝试重定向: http://www.[subdomains.]thedomain.ml http://[subdomains.]thedomain.ml https://www.[subdomains.]thedomain.ml https://[subdomains.]thedomain.ml http://www.[subdomains.]ledomain.ml http://[subdomains.]ledomain.ml https://www.[subdomains.]ledo

我正在尝试重定向:

http://www.[subdomains.]thedomain.ml
http://[subdomains.]thedomain.ml
https://www.[subdomains.]thedomain.ml
https://[subdomains.]thedomain.ml

http://www.[subdomains.]ledomain.ml
http://[subdomains.]ledomain.ml
https://www.[subdomains.]ledomain.ml
https://[subdomains.]ledomain.ml

其中,
[子域]
的值未知,可以采用多个值

我浏览了很多stackoverflow的帖子,但是我找不到一个解决方案,在重定向中也包含了子域

我当前的.htaccess文件在下面,但不包括子域

SetEnv PHP_VER 5_4
Options -Indexes
Options +FollowSymLinks
RewriteEngine On

RewriteCond %{HTTPS} off [OR]
RewriteCond %{HTTP_HOST} !^domain3\.fr$ [NC]
RewriteRule ^ https://domain3.fr%{REQUEST_URI} [R=301,L,NE]


<Files .htaccess>
order allow,deny
deny from all
</Files>


SetEnv PHP第5版第4版
选项-索引
选项+FollowSymLinks
重新启动发动机
重写cond%{HTTPS}关闭[或]
重写cond%{HTTP_HOST}^域3\.fr$[NC]
重写规则^https://domain3.fr%{REQUEST_URI}[R=301,L,NE]
命令允许,拒绝
全盘否定

感谢您所展示的样品,请尝试以下内容。请确保在测试URL之前清除浏览器缓存

SetEnv PHP_VER 5_4
Options -Indexes
Options +FollowSymLinks

RewriteEngine ON
RewriteCond %{HTTP_HOST} ^(?:www\.)?(?:[\w-]+\.)?([\w-]+)\.ml$ [NC]
RewriteRule ^ https://%1.fr%{REQUEST_URI} [R=301,L,NE]
SetEnv PHP_VER 5_4
Options -Indexes
Options +FollowSymLinks

RewriteEngine ON
RewriteCond %{HTTP_HOST} ^(?:www\.)?(?:[\w-]+\.)?([\w-]+)\.ml$ [NC]
RewriteRule ^ https://%1.fr%{REQUEST_URI} [R=301,L,NE]