元素“ system.webServer”具有无效的子元素“ rewriteMaps”。可能的元素列表,如:asp,缓存,cgi,defaultDocument,目录浏览,globalModules,处理程序,httpCompression,webSocket,httpErrors,httpLogging,httpPlatform,aspNetCore,httpProtocol,httpRedirect,httpTracing,isapifilters,模块,applicationInitialization,odbcLogging,安全性,serverRuntime, serverSideInclude,staticContent,跟踪,urlCompression,验证,管理,重写'
我了解这是以下内容的重复: The element > system.webServer' has invalid child > element 'rewrite'
我怀疑答案已经过时,也许有替代解决方案,甚至可能是更深入的答案。我该如何解决该错误。
目标是将网址列表重定向到其他网址
<rewriteMaps>
<rewriteMap name="Soft404">
<add key="/url-1" value="/url-2" />
<add key="/url-3" value="/url-4" />
<add key="/url-5" value="/url-6" />
</rewriteMap>
</rewriteMaps>
<rules>
<rule name="Redirect Rule" stopProcessing="true">
<match url=".*" />
<conditions>
<add input="{Soft404:{HTTP_URL}}" pattern="(.+)" />
</conditions>
<action type="Redirect" url="https://www.example.com/{C:1}" redirectType="Permanent" />
</rule>
</rules>