Server Fault is a question and answer site for system and network administrators. It's 100% free, no registration required.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I need to rewrite the URL:


I am Using IIS 7.5 and VS 2008.

I need the text to insert in web.config.

share|improve this question

Install URL Rewriting then inside web.config at the XML path system.webServer/rewrite/rules

<rule name="Rule" stopProcessing="true">
  <match url="test.aspx" />
    <add input="{QUERY_STRING}" pattern="pagename=([a-zA-Z0-9]+)&amp;companycode=([0-9]+)" />
  <action type="Rewrite" url="test/{C:1}/{C:2}" appendQueryString="false" />

If you don't need all parameters in the query string then you can replace the regex and parameters ({C:1}/{C:2}) with their literals.

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.