簡體   English   中英

使用htaccess重定向目錄,但不重定向其中的文件

[英]Using htaccess to redirect a directory, but not the files in it

在我的網站上,我有一個目錄/ folder,其中包含一些圖像和html。 我想將嘗試訪問http://domain.com/folder的用戶重定向到http://domain.com/,但不希望該目錄中文件的請求重定向到http://domain.com/要么。 當我嘗試

Redirect /folder http://domain.com/

它破壞了站點,因為現在它認為所有圖像等都不在根目錄中。 我該如何解決?

改用RedirectMatch

RedirectMatch ^/folder$ http://example.com/

現在,URI路徑必須與/folder完全匹配。

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM