I have a rule in IIS to append a slash at the end (if there is no). It is working fine but in my case, I only need it for the first time. I have a reverse proxy on IIS to forward the request to another server. With this rule, it appends the slash all the time.
How I can modify the rule to append the slash only if there is not any after a keyword like 'myapp' so that it appends the slash if a URL is like http://myserver/myapp
<rule name="AddTrailingSlashRule1" stopProcessing="true">
<match url="(.*[^/])$" />
<conditions>
<add input="{REQUEST_FILENAME}" matchType="IsDirectory" negate="true" />
<add input="{REQUEST_FILENAME}" matchType="IsFile" negate="true" />
</conditions>
<action type="Redirect" url="{R:1}/" />
</rule>
I tried changing the regular expression in url="(.*myapp[^/])$" but it does not work.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.