iis - 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 重写模块只能将一个 URL 重写为另一个 URL,因此无法直接将 URL 重写为物理路径文件夹。您可以使用根文件夹创建另一个网站/local_path/all_customers/
。这样您就可以轻松地反向代理siteA/Xfolder/yfile.htm
到siteB/Xfolder/yfile.htm
.
请安装 ARR 和反向代理来实现这一点。 ARR 和反向代理
并且反向代理功能默认禁用,因此您必须首先在“应用程序请求路由”功能中启用它。
推荐阅读
- .htaccess - 我的自定义路由在 Codeigniter 3 中不起作用
- ruby-on-rails - 如何在rails关联中打印多个表格的数据?
- python - 如何将python脚本编译为可执行文件?
- spring-boot - 使用 Spring Boot 在 RabbitMQ 上不断调用 MessageListener.onMessage
- mysql - 创建学生测试的项目/Web 应用程序,在其中我们从“表单”收集输入并将它们存储在数据库中,并将进一步访问它们
- spring-integration - Spring文件集成java配置
- arrays - 循环浏览所有网页的链接并再次导航
- r - 当 id 变量在列标题中编码时将数据从宽格式转换为长格式
- android - 回调侦听器未调用 Android ViewModel
- android - Android应用中WebView+webRTC中授予权限的问题