簡體   English   中英

URL 將子域根目錄的所有文件夾重寫到不同文件路徑中的文件夾

[英]URL Rewrite all folders at root of subdomain to folder in a different file path

我需要從sub.domain.com/Xfolder/yfile.htm重寫 --> /local_path/all_customers/xfolder/yfile.htm

all_customers 文件夾中有許多 xfolders。 sub.domain.com 的 IIS 根目錄中不存在任何文件夾或文件。 所有文件夾和文件實際上都存在於本地文件夾中,而不是 URL。

我需要這樣的代碼,但我還需要允許 URL 變量。

RewriteEngine on    
RewriteCond %{HTTP_HOST} !^sub\.domain\.com$ [NC]
RewriteRule !^file_path_to_folders\all_customers\$ [R=302,L]

URL rewrite module can only rewrite a URL to another URL so it is unavailable to rewrite URL to a physical path folder directly. 您可以使用根文件夾/local_path/all_customers/創建另一個網站。 這樣您就可以輕松地將代理siteA/Xfolder/yfile.htm siteB/Xfolder/yfile.htm

請安裝 ARR 和反向代理來實現這一點。 ARR 和反向代理

並且反向代理功能默認被禁用,因此您必須首先在“應用程序請求路由”功能中啟用它。

暫無
暫無

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

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