2012-03-27 277 views
0

有道我有這樣的:域重定向到另一個域在阿帕奇

<VirtualHost *:80> 

    "DocumentRoot C:/Program Files (x86)/Apache Software Foundation/Apache2.2/htdocs/mysite" 

    ServerName mysite.eu 

    ServerAlias www.mysite.eu 
    ServerAlias play.mysite.eu 

    ServerAlias www.mysite.org 
    ServerAlias play.mysite.org 
    ServerAlias mysite.org 

    DirectoryIndex index.php 

    Options -Indexes 

</VirtualHost> 

爲什麼這個沒有自動跳轉,從mysite.org所有請求mysite.eu?那麼正確的做法是什麼?

回答

0

你有什麼只有當有人去www.mysite.eu(然後需要指向服務器的IP)時使用,以便Web服務器知道使用虛擬主機文件來服務請求 - 即沒有重定向。如果你想重定向,使用mod_rewrite,例如

RewriteCond %{HTTP_HOST} ^www\.mysite\.org$ [OR] 
RewriteRule ^.*$ "http\:\/\/www\.mysite\.eu" [R=301,L,QSA] 
+0

嗯,有些東西的戰鬥。當我把它放在這裏時,我看到狀態欄在最終放棄這條消息之前從mysite.org來回閃爍到mysite.eu:頁面沒有正確重定向 Firefox已經檢測到服務器正在重定向請求這個地址的方式永遠不會完成。 此問題有時可能由禁用或拒絕接受 Cookie引起。 – 2012-03-27 12:16:25

+0

這意味着你有一個無限的重定向循環 – scibuff 2012-03-27 12:44:36

相關問題