2011-12-01 64 views
0

如何在Phusion Passenger的虚拟主机工作中获得正常的重写规则?在虚拟主机中为PhusionPassenger使用RewriteEngine可以吗?

这里是我想要做的事:

RewriteEngine on 

RewriteCond %{HTTP_HOST} !^www\.google\.com [NC] 
RewriteRule (.*) http://www.google.com$1 [R=301,L] 

我基本上要任何流量来xyz2.google.com/abc到重定向到www.google.com/abc

有任何想法吗?

回答

0

我在一起使用Apache与乘客,我的Apache配置看起来是这样的:

<VirtualHost mysite.com:80> 
    Redirect permanent/https://mysite.com 
</VirtualHost> 

<VirtualHost *:80> 
    RewriteEngine On 
    ReWriteCond %{SERVER_PORT} !^443$ 
    RewriteRule ^/(.*) https://mysite.com/$1 [NC,R,L] 
</VirtualHost> 

这工作得很好,我重定向一切https://mysite.com 应该为你工作类似。

0

一般来说是。如果您使用PassengerHighPerformancesetting作为位置,则不应使用该位置的重写规则。

请检查您的乘客版本,但早于2.1.1的版本与mod_rewrite不完全兼容

相关问题