I'm working with URL rewriting in a Web.config file and I'm facing an issue with an extra slash appearing in my redirected URLs. Here’s the rule I've got so far:
<rule name="Redirect Users to Candidates" stopProcessing="true"> <match url="^users(.*)" /> <action type="Redirect" url="candidates{R:1}" /> </rule>
This rule is intended to redirect URLs in two scenarios:
When navigating to /users?text=smith, it redirects to /candidates/?text=smith. However, I want it to redirect to /candidates?text=smith without the additional slash before the query string.
It is also intended to redirect /users/A123456 to /candidates/A123456, which it does successfully, but I cannot get it to not have the additional trailing slash when there is a query string involved.
Thank you in advance!
<rewrite>
inWeb.config
.