Apache mod_rewrite:将子域重定向到HTTPS登录页面

时间:2010-01-21 12:29:09

标签: apache .htaccess mod-rewrite

我正在努力实现这个目标:

http://subdomain.server.com/应重定向到https://secure.server.com/login?subdomain,但http://subdomain.server.com/any-other-page应按原样传递。

我可以在.htaccess文件中完成此操作吗?

2 个答案:

答案 0 :(得分:0)

RedirectMatch ^/?$ https://secure.server.com/login?subdomain

答案 1 :(得分:0)

尝试此规则:

RewriteCond %{HTTP_HOST} !=secure
RewriteCond %{HTTP_HOST} ^([^/.]+)\.example\.com$
RewriteRule ^$ https://secure.example.com/login?%1
相关问题