问题
I've tried around getting the following to work for 2 hours now.
I have multiple domains such as: Test.Xy.zz Test.Abc.de Test.mmm.mm
Now only Test.xy.zz got an ssl certificate and the application running on it is limited to it. Therfor I want all non-ssl requests - including test.xy.zz and all other domains to go to https://test.xy.zz
Hope someone can help.
Possible solution:
RewriteEngine On
RewriteCond %{HTTP_HOST} !test\.xy\.zz
RewriteRule ^(.*) https://test.xy.zz/$1 [QSA,R=301]
RewriteCond %{HTTPS} !on
RewriteRule ^(.*) https://test.xy.zz/$1 [QSA,R=301]
Hope this helps anyone.
回答1:
RewriteCond %{HTTPS} !on [OR]
RewriteCond %{HTTP_HOST} !^test.xy.zz$
RewriteRule (.*) https://test.xy.zz$1 [QSA,R=301]
来源:https://stackoverflow.com/questions/15212134/htaccess-rule-multiple-domains-to-one-ssl-domain