Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Getting IIS7 to rewrite but still pass querystring parameters?

Tags:

iis-7

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?

like image 433
mitch Avatar asked Jun 18 '10 17:06

mitch


1 Answers

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.

like image 187
Eric Petroelje Avatar answered Nov 05 '22 07:11

Eric Petroelje