我在web.config中的重写规则正确地从“example.com/home”重定向到“example.com/”,但无法从“example.com/home/”重定向(唯一的区别是正向斜杠)后者)。我想知道如何让第二个例子起作用。我的web.config:
<?xml version="1.0" encoding="utf-8"?>
<configuration>
<system.webServer>
<rewrite>
<rules>
<rule name="mysite.com/home or mysite.com/home/ to mysite.com/" stopProcessing="true">
<match url="(.*)\/?\bhome\/?\b$" />
<action type="Redirect" url="/" redirectType="Permanent"/>
</rule>
</rules>
</rewrite>
<handlers>
<add name="aspNetCore" path="*" verb="*" modules="AspNetCoreModule" resourceType="Unspecified"/>
</handlers>
<aspNetCore processPath="%LAUNCHER_PATH%" arguments="%LAUNCHER_ARGS%" stdoutLogEnabled="false" stdoutLogFile=".\logs\stdout" forwardWindowsAuthToken="false"/>
</system.webServer>
</configuration>