简体   繁体   English

如何使用正则表达式重写IIS中的URL

[英]How to rewrite URL in IIS using regex

I have IIS and want to configure URL rewriting. 我有IIS,并希望配置URL重写。 How I can to rewrite any type of URL like: 如何重写任何类型的URL,如:

http://anydomain.com/subfolder/page.html http://anydomain.com/subfolder/page.html

to

http://anydomain.com/mysubfolder/subfolder/page.html http://anydomain.com/mysubfolder/subfolder/page.html

So only what I need is to add just one subfolder name into URL after host name. 所以我只需要在主机名后面的URL中添加一个子文件夹名称。

Regex for split url 分裂网址的正则表达式

^(https?:\/\/[^\/]*\/)(.*)$

and How-To iis url rewrite. How-to iis url重写。 Your pattern must look like that 您的模式必须如此

{R:1}mysubfolder/{R:2}

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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