Using URL Rewrite Module 2.0 | Microsoft Docs/en-us/iis/extensions/url-rewrite-module/using-url-rewrite-module-20参考连接如上,注意重定向和重写不一样,如果只是隐藏端口,那么用重定向比较好
<configuration><system.webServer><rewrite><rules><rule name="Fail bad requests"><match url="." /><conditions><add input="{HTTP_HOST}" negate="true" pattern="localhost" /></conditions><action type="AbortRequest" /></rule><rule name="Rewrite to article.aspx"><match url="^article/([0-9]+)/([_0-9a-z-]+)" /><action type="Redirect" url="/index.html" /></rule></rules></rewrite><tracing><traceFailedRequests><add path="*"><traceAreas><add provider="WWW Server" areas="Rewrite" verbosity="Verbose" /></traceAreas><failureDefinitions timeTaken="00:00:00" statusCodes="200-399" /></add></traceFailedRequests></tracing></system.webServer></configuration>