开发者

Getting IIS7 to rewrite but still pass querystring parameters?

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.


You might want to check this out: http://learn.iis.net/page.aspx/465/url-rewrite-module-configuration-reference/#Rules_Evaluation

But according to this article, in the Rewrite Action there is a 'appendQueryString' parameter which determines whether the query string is appended to the new URL. This should be on by default (again according to that article), so you shouldn't have to do anything.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜