我有一个在生产中使用SSL证书的网站。同时,暂存版本(staging.domain.com)应该只解析为http。
RewriteCond %{HTTPS} off
RewriteCond %{HTTP_HOST} ^(www\.)?domain\.com$ [NC]
RewriteRule ^ https://%{HTTP_HOST}%{REQUEST_URI} [R=301,L]
RewriteCond %{HTTPS} on
RewriteCond %{HTTP_HOST} ^(www\.)?domain\.in$ [NC]
RewriteRule ^ http://%{HTTP_HOST}%{REQUEST_URI} [R=301,L]
我知道可以使用htaccess完成,但我根本无法让它工作。