Asp.net 重写规则不匹配低于1子级别的任何内容
我试图在web.config中为asp站点编写重定向规则,但遇到子文件夹问题 如果我访问http://www.thesite.com/folder 它重定向到http://www.thesite.com 很好,但是如果我访问像这样的子文件夹http://www.thesite.com/folder/folder 它没有-谁能帮我修改我的匹配规则,让它将所有流量发送到根目录 以下规则就是我刚才所说的:Asp.net 重写规则不匹配低于1子级别的任何内容,asp.net,url-rewriting,web-config,http-status-code-301,Asp.net,Url Rewriting,Web Config,Http Status Code 301,我试图在web.config中为asp站点编写重定向规则,但遇到子文件夹问题 如果我访问http://www.thesite.com/folder 它重定向到http://www.thesite.com 很好,但是如果我访问像这样的子文件夹http://www.thesite.com/folder/folder 它没有-谁能帮我修改我的匹配规则,让它将所有流量发送到根目录 以下规则就是我刚才所说的: <?xml version="1.0" encoding="utf-8" ?>
<?xml version="1.0" encoding="utf-8" ?>
<configuration>
<system.webServer>
<rewrite>
<rules>
<rule name="Remove trailing slash" stopProcessing="true">
<match url="(.*)/$" />
<conditions>
<add input="{REQUEST_FILENAME}" matchType="IsFile" negate="true" />
<add input="{REQUEST_FILENAME}" matchType="IsDirectory" negate="true" />
</conditions>
<action type="Redirect" redirectType="Permanent" url="{R:1}" />
</rule>
<rule name="redirect all requests" stopProcessing="true">
<match url=".+" ignoreCase="false" />
<conditions logicalGrouping="MatchAll">
<add input="{REQUEST_FILENAME}" matchType="IsFile" negate="true" pattern="" ignoreCase="false" />
</conditions>
<action type="Rewrite" url="/index.php" appendQueryString="false" redirectType="Permanent" />
</rule>
</rules>
</rewrite>
</system.webServer>
是否有人再回答,或者只是浏览要编辑的帖子标签? 我自己找到了解决方案-对于那些可能对实际解决方案感兴趣的人,我将操作员更改为:
<match url="(.*)/$" />
这就解决了问题