简体   繁体   中英

IIS Web.Config 301 Redirect on Query String Parameter (?)

    <rule name="blog" stopProcessing="true">
      <match url="en/blog.aspx?Id=9" />
      <action type="Redirect" url="http://www.mynewurl.com" redirectType="Permanent" />
    </rule>

I can redirect "en/blog.aspx" but I am unable to redirect only "en/blog.aspx?Id=9".

Any Ideas?

Finally found the solution:

/en/blog.aspx?Id=9 will redirect to http://www.newurl.com .

    <rule name="blog" stopProcessing="true">
      <match url="en/blog.aspx$" />
      <conditions>  
        <add input="{QUERY_STRING}" pattern="Id=9" />  
    </conditions>  
      <action type="Redirect" url="http://www.newurl.com" redirectType="Permanent" />
    </rule>

Found the solution here : 301 redirect not working in IIS 7

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM