2011-07-28 82 views
0

所以我想重定向:重寫URL重定向主機

  1. first.comsecond.com
  2. first.com/somethingsecond.com/redir.php?q=something

,所以我做

RewriteCond %{HTTP_HOST} ^.*first.com$ 
RewriteRule ^(.*)$ http://second.com/redir.php?q=$1 [R,L] 

但其唯一的工作1,它發送到second.com/redir.php?q=

回答

2

我希望第二個案例適合你的規則。對於第一個,你可以添加另一個規則:

RewriteCond %{HTTP_HOST} ^.*first.com$ 
RewriteRule ^$ http://second.com/ [R,L] 
+0

感謝,它的工作1,而不是2,它給沒有找到,請求的URL的index.php在此服務器上找到。 – ariel

+0

好吧,從來沒有..它的工作..有一個#wordpress塊,我只是把它移到 – ariel

+0

以上注意這個規則將不得不在問題中給出的。 –