简体   繁体   中英

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

I need to rewrite from sub.domain.com/Xfolder/yfile.htm --> /local_path/all_customers/xfolder/yfile.htm

There are many xfolders in the all_customers folder. No folders or files exist in the IIS root of sub.domain.com. All of the folders and files actually exist in a local folder and not a URL.

I need something like this code, but I also need to allow for URL variables.

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. You can create another website with the root folder /local_path/all_customers/ . So that you can easily reverse proxy siteA/Xfolder/yfile.htm to siteB/Xfolder/yfile.htm .

Please install ARR and reverse proxy to achieve this. ARR and reverse proxy

And reverse Proxy functionality is disabled by default, so you must begin by enabling it in Application Request Routing" feature.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM