我正在运行一个有2个独立子域的站点 - 一个用于HTTP,另一个用于HTTPS。
I'm running a site which has 2 separate sub-domains - one for HTTP and another for HTTPS.
- www.example
- secure.example
- www.example
- secure.example
secure.example 不存在并且无法解决。
secure.example does not exist and will not resolve.
问题是该网站正在负责处理所有SSL的负载均衡器后面运行。始终在HTTP中负载均衡器和Web服务器之间的通信。
The problem is that the site is running behind a load balancer which handles all SSL. Communication between the load balancer and the web servers in always HTTP.
因此,当使用Isapi Rewrite 3(IIS的mod_rewrite克隆)实现某些重定向时,我正在运行问题。
So, when using Isapi Rewrite 3 (a mod_rewrite clone for IIS) to implement some redirects I'm running into a problem.
就Isapi Rewrite而言,HTTPS已关闭 - 因此重定向 secure.example 失败。
As far as Isapi Rewrite is concerned HTTPS is turned off - so redirects on secure.example are failing.
说我有一条规则说:
RewriteRule ^/example/$ /test/ [R=301,L]如果我制作请求 secure.example/example/ 我想结束 secure.example/test/ 但是,因为Isapi Rewrite认为HTTPS为OFF,我最终选择 http:/ /secure.example/test/ 。
If I make a request for secure.example/example/ I would like to end up on secure.example/test/ but, because Isapi Rewrite sees HTTPS as OFF, I end up on secure.example/test/.
有什么办法可以强制重定向到HTTPS,如果域名是 secure.example ?
Is there any way I can force redirects to be to HTTPS if the domain is secure.example?
有些内容如下:
RewriteCond %{SERVER_NAME} secure.example RewriteRule ^/(.*)$ secure.example/$1除非不起作用 - 它会立即强制显式重定向,而我想继续处理其他 RewriteRules 。
Except that doesn't work - it immediately forces an explicit redirect, whereas I want to continue processing other RewriteRules.
谢谢,
Stu
推荐答案这样的smth怎么样:
How about smth like this:
RewriteCond %{HTTPS} off RewriteCond %{HTTP_HOST} ^secure\.mydomain\$ [NC] RewriteRule ^/example/$ secure.mydomain/test/ [R=301,L]更多推荐
Isapi Rewrite
发布评论