Reputation: 704
I am trying to redirect:
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
to
https://[subdomains.]domain3.fr
where the value of [subdomains.]
is not known and can take multiple values.
I browsed stackoverflow posts a lot but I couldn't find a solution which also includes subdomains into the redirection.
My current .htaccess file is below but doesn't include subdomains
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>
Thank you
Upvotes: 1
Views: 36
Reputation: 133760
With your shown samples, could you please try following. Please make sure you clear your browser cache before testing URLs.
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]
Upvotes: 1