0
我在重定向服務器上不存在的整個目錄時遇到問題。如何永久重定向不再存在的目錄(通過.htaccess)
以下所有變化都不起作用,我只是得到404頁面未找到。
.htaccess文件看起來像這樣:
redirect 301 /non_existent_directory/ http://my.website.com/existent_directory/
是否有可能使用這種重定向301指令?或者這隻能通過mod_rewrite解決?
感謝
我甚至嘗試:
Options +FollowSymLinks
RewriteEngine On
RewriteCond %{HTTP_HOST} ^(www\.)?my\.website\.com\/non_existent_directory\/$ [NC]
RewriteRule ^(.*)$ http://my.website.com/existent_directory/ [R=301,L]
沒有運氣...
我被允許使用.htaccess - 它在我的整個服務器中普遍使用。然而,只要我在「http:// my.website.com/non_existent_directory」或「http:// my.website.com/non_existent_directory /」或「http://我的網站上點擊任何內容,該指令就會生成404 PNF @OlafDietsche .website.com/non_existent_directory/anypage.html' – 2013-02-26 13:25:05
我已經使用其他重定向301的其他.htaccess文件fpr丟失的文件,他們已經工作。這是我第一次嘗試重定向一個不存在的整個目錄... – 2013-02-26 13:30:31
@ H.Ferrence如果沒有日誌信息,很難判斷真正發生了什麼。無論如何,你可以嘗試上面的其他選擇。 – 2013-02-26 13:39:28