How to redirect an specific url with specific variables in iis

Try this:

<configuration>
  <system.webServer>
    <rewrite>
      <rules>
        <rule name="MyRule" patternSyntax="ECMAScript" stopProcessing="true">
          <match url="^folder/Default.aspx$" />
          <action 
              type="Redirect" 
              url="folder/Default.aspx?&amp;variable1=ffff&amp;variable2=gggg" 
              appendQueryString="false" 
              redirectType="Found" /> 

          <conditions logicalGrouping="MatchAny">
            <add input="{QUERY_STRING}" 
                 pattern="^&amp;variable1=eeee&amp;variable2=aaa$" />

            <add input="{QUERY_STRING}" 
                 pattern="^variable1=eeee&amp;variable2=aaa$" />
          </conditions>
        </rule>
      </rules>
    </rewrite>
  </system.webServer>
</configuration>

Set the redirectType attribute in the <action> element to one of:

  • Permanent for a 301 Permanent redirect
  • Found for a 302 Found redirect

This covers the possibility of the query string being:

&variable1=eeee&variable2=aaa - as per your example, with a leading ampersand

or with the leading ampersand:

variable1=eeee&variable2=aaa

If you just want a straight rewrite without doing a redirect then change the <action> element to:

<action type="Rewrite" 
        url="folder/Default.aspx?&amp;variable1=ffff&amp;variable2=gggg" 
        appendQueryString="false" />