How to redirect a url only with specific parameters in IIS

前端 未结 1 1056
遇见更好的自我
遇见更好的自我 2021-01-25 19:58

I have a url that looks like this:

www.mywebsite.com/page.aspx?code=1.a

I want to redirect this URL via IIS to:

www.mywebsite.c         


        
1条回答
  •  悲&欢浪女
    2021-01-25 20:37

    An easy way to do this in IIS 7.5 is to install the URL Rewrite extension from Microsoft into IIS.

    http://www.iis.net/downloads/microsoft/url-rewrite

    Once you have it installed, you can just add a rule to redirect from ?code=1.a to ?code=1.b. In IIS, you'll see a new entry called URL Rewrite under the IIS heading for your website. You can use the editor there to create a new rule. Once the rule is created, it will be written into your web.config file.

    In the web.config file, the rule should look something like this:

    
        ...
        
            
                
                    
                    
                    
                        
                    
                
            
        
        ...
    
    

    0 讨论(0)
提交回复
热议问题