在运行 varnish 的 apache 2.2 服务器上,我试图将 http -> 重定向到整个 Drupal Commons ( http://commons.acquia.com/ ) 站点的https 。
由于 varnish 缓存了一些重定向(我认为是 R=301,但不是 R=302),我首先让重定向在 :8080 工作,而 varnish 不提供该重定向。
下面的 .htaccess 代码成功地将 http://foo.example.com:8080 重定向到 https://foo.example.com。(适用于 Chrome、FF 和 Safari。)
# RewriteBase /
### Standard Drupal7 .htaccess above here ###
# SSL REWRITES
RewriteCond %{SERVER_PORT} ^8080$
RewriteRule ^(.*)$ https://foo.example.com/$1 [NC,R=302,L]
### Standard Drupal7 .htaccess below here ###
# Rewrite URLs of the form 'x' to the form 'index.php?q=x'.
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_URI} …Run Code Online (Sandbox Code Playgroud)