重定向到https,子域重定向到http

时间:2015-09-09 15:06:58

标签: .htaccess redirect ssl https

我有一个在生产中使用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完成,但我根本无法让它工作。

  • www.domain.com / domain.com应重定向到https
  • staging.domain.com应重定向到http

0 个答案:

没有答案