问题
I have built up a project and deployed it in iis server and the web.config file looks like,
<?xml version="1.0" encoding="UTF-8"?>
<configuration>
<system.webServer>
<rewrite>
<rules>
<rule name="about" stopProcessing="true">
<match url="^about$" />
<action type="Rewrite" url="/about.html" />
</rule>
<rule name="contact" stopProcessing="true">
<match url="^contact$" />
<action type="Rewrite" url="/contact.html" />
</rule>
</rules>
</rewrite>
</system.webServer>
</configuration>
Folder structure.
This above code works fine if we navigate to https://your-site.com/contact
or https://your-site.com/about
.
Same way I also have dynamic routing like toolboxlinks/[toolboxlinks].html
Folder structure (On click the toolboxlinks folder from above screenshot, it results in)
For above scenario, I have included the rule like,
<rule name="toolboxlinks" stopProcessing="true">
<match url="^toolboxlinks/[toolboxlinks]$" />
<action type="Rewrite" url="toolboxlinks/[toolboxlinks].html" />
</rule>
But it doesn't work and throws 404 error
like,
I am entirely new to this scenario, So how to get rid of this error for dynamic routing?
来源:https://stackoverflow.com/questions/65958458/dynamic-routing-handling-in-web-config