IIS7 Url Rewrite Rule regex to make new path and strip extension
-
05-12-2019 - |
Question
How can I create rewrite rule is to achieve the following:
before: content/release/0.9.html
after: release-notes/0.9
right now I'm having:
<rule name="Rewrite rule1 for content">
<match url="^content/release/(.+)$" />
<action type="Rewrite" url="release-notes/{R:1}" />
</rule>
How can I get rid of the ".html" in the "after" output?
Solution
Try this:
<rule name="Rewrite rule1 for content">
<match url="^content/release/(.+)\.html$" />
<action type="Rewrite" url="release-notes/{R:1}" />
</rule>
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow