I am trying to set up a rewrite rule in IIS7 to hide page extensions (.aspx) but also field and pass querystring parameters to the page.
For example, if the original URL is:
www.mysite.com/page.aspx?pid=a
how can I get it to rewrite to
www.mysite.com/page
but still pass the querystring value to the page?
If you are putting it into a web.config, You are looking for appendQueryString
<rule name="MyRule" stopProcessing="true">
<match url="{your regex}" ignoreCase="false" />
<action type="Rewrite" url="{your rewrite}" appendQueryString="true" />
</rule>
If you are doing it in IIS Manager, check the "Append query string" box.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With