[英].htaccess redirect http and https subdomain to other domain
I have subdomain: subdomain.example.com 我有子域:subdomain.example.com
I would like to redirect http and https to another domain 我想将http和https重定向到另一个域
http://subdomain.example.com --> https://subdomain.exampleNew.com
https://subdomain.example.com --> https://subdomain.exampleNew.com
Does anyone know how to do this? 有谁知道如何做到这一点?
Currently I have only: 目前我只有:
RewriteCond %{HTTP_HOST} ^subdomain.example.com$ [NC]
RewriteRule ^(.*)$ https://subdomain.exampleNew.com/$1 [R=301,L]
If you want to retain the http/https status, the status needs to be captured first and then passed to the rule as %1
. 如果要保留http / https状态,则需要先捕获该状态,然后将其作为%1
传递给规则。 Use the following instead: 请改用以下内容:
RewriteCond %{HTTPS}s ^on(s)|off
RewriteCond %{HTTP_HOST} ^subdomain.example.com$ [NC]
RewriteRule ^(.*)$ http%1://subdomain.exampleNew.com/$1 [R=301,L]
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.