I'm trying to create a rewrite rule that will remove a username from the URL and instead append a userID to the URL. For example
www.mysite.com/USERNAME/profile/?urlvar1=true
should be rewritten to
www.mysite.com/profile/?urlvar1=true&userID=1
The rule I have created (below) seems to work but I'm worried that there would be 2 question marks in the URL so for example
www.mysite.com/profile/?urlvar1=true?userID=1
Is this going to be an issue? If so is there a way around this?
<rule name="New Rule 1" enabled="true">
<match url="^USERNAME/(.*)" />
<action type="Rewrite" url="{R:1}?userID=1" />
</rule>
It will not be an issue, IIS rewrite module will replace second question mark into &. In your example it will be: /profile?userID=1&urlvar1=true
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.