2013-12-18 45 views
0

所以我有一個站點設置爲http://weddings.gigmasters.com,像這樣:301重定向整個虛擬主機,而不包括網址

<VirtualHost *:80> 
    ServerName weddings.gigmasters.com 
    Redirect 301/http://www.gigmasters.com/events/wedding 
</VirtualHost> 

現在,你可以看到,當你去http://weddings.gigmasters.com,它正確地重定向。然而,當我去http://weddings.gigmasters.com/a-url-goes-here之類的東西,它會去http://www.gigmasters.com/events/weddinga-url-goes-here,這絕對不是我想要的。有沒有一種方法使用Apache重定向重定向沒有附加的URL?

回答

0

因此,原來的Apache有RedirectMatch,它可以這樣使用:

RedirectMatch 301 (.+) http://www.gigmasters.com/events/wedding

...基本上捕獲任何網址並取消它,然後重定向到正確的URL。

0

嘗試Redirectmatch而不是用正則表達式的功能:

RedirectMatch 301 ^/(?!events/wedding$).*$ /events/wedding