2011-12-01 43 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不完全兼容

相關問題