通过HTTPS将所有请求redirect到与公共和私有IP一起使用的方式

我想强制Apache通过HTTPSredirect所有stream量:

# Redirect HTTP traffic to HTTPS. RewriteEngine On RewriteCond %{HTTPS} off RewriteRule ^(.*)$ https://mypublicip/$1 [R=301,L] 

不幸的是,当我尝试使用我的Web服务器的私有IP从本地networking访问我的网站时,这不起作用。 我怎么能解决这个限制?

mod_rewrite支持更多variables,如%{HTTPS} 。 为了您的要求, %{HTTP_HOST}是要走的路。