rewrite rule

StewSupport used Ask the Experts™
the code below will hide aspx extension. but now if my page is the page stop working. Can someone help me with this? how do i make it so that it will do both hide .aspx extension and replace ?id=1&name=test to /1/test. i want it to be dynamic i don't want to have to list out all of the ids and name in my rule. please help. thank you in advance

        <rule name="RemoveASPX" enabled="true" stopProcessing="true">
          <match url="(.*)\.aspx" />
          <action type="Redirect" url="{R:1}" />
        <rule name="AddASPX" enabled="true">
          <match url=".*" negate="false" />
            <add input="{REQUEST_FILENAME}" matchType="IsFile" negate="true" />
            <add input="{REQUEST_FILENAME}" matchType="IsDirectory" negate="true" />
            <add input="{URL}" pattern="(.*)\.(.*)" negate="true" />
          <action type="Rewrite" url="{R:0}.aspx" />

Open in new window

Watch Question

Do more with

Expert Office
EXPERT OFFICE® is a registered trademark of EXPERTS EXCHANGE®


i found those links too but not really doing it. here is what i added and it doesn't seem to be working
<rule name="Query String Rewrite">  
	  		<match url="test\test.aspx$" />  
				<add input="{QUERY_STRING}" pattern="p1=(\d+)" />  
	  		<action type="rewrite" url="test/test.aspx?id={C:1}" appendQueryString="false"/>

Open in new window

remember before this rule is a rule to remove .aspx extension too

Do more with

Expert Office
Submit tech questions to Ask the Experts™ at any time to receive solutions, advice, and new ideas from leading industry professionals.

Start 7-Day Free Trial