0
我google至少有3個小時,並嘗試所有的例子在堆棧溢出和其他論壇。 有誰知道如何使用.htaccess(重定向或重寫)能夠將所有流量從一個域重定向到另一個域,而不會在.com之後傳遞任何內容?重定向整個請求到新的域名,沒有後續的原始請求.com後的任何內容
我有一個老域名:
http://www.olddomain.com
我想所有的請求到該域重定向到一個特定的URL
http://www.newdomain.com/new/directory/
我試圖重定向的相當多的種類和重寫規則.htaccess,但如果我提出如下請求:
http://www.olddomain.com/some/directory/
重定向總是出現在新域如:
http://www.newdomain.com/new/directory/some/directory/
重定向是等待重定向的URI後。
我試過添加?在新網址的末尾,這並沒有幫助。
這是我的一些重定向。 (域名更改爲保護無辜者)
RewriteEngine on
#RewriteRule^http://www.newdomain.com/new/directory/ [R=301,L]
#RewriteRule^http://www.newdomain.com/new/directory/? [R=301,L]
#RewriteRule /?$ http://www.newdomain.com/new/directory/? [R=301,L]
RewriteRule ^([^/\.]+)/?$ http://www.newdomain.com/new/directory/? [R=301,L]
我嘗試了重定向命令,以及...
Redirect 301/http://www.newdomain.com/new/directory/?
這些都不似乎刪除/一些/目錄/和自顧自地重定向到
http://www.newdomain.com/new/directory/some/directory/
任何想法將非常感激。