Rewrite maps in IIS7 — how to make the match optionally include a trailing slash?

后端 未结 2 1204
既然无缘
既然无缘 2021-02-07 12:51

I have read the top 30 Google hits for several combinations of IIS rewrite map condition and so on, but I can\'t find any decent documentation, either on a micros

2条回答
  •  深忆病人
    2021-02-07 13:09

    This should do it:

    
        
            
                
                
                
            
        
        
            
                
                
                    
                
                
            
        
    
    

    You were quite close; I only needed to make three small changes:

    • removed the leading slashes in the keys in the rewrite map
    • used the non-greedy quantifier +? in the rule's match
    • used a back reference to the match {R:1} in the condition input

    I share your experience in having trouble finding decent documentation; I had to experiment my way through, with help from the following articles:

    • http://www.iis.net/learn/extensions/url-rewrite-module/using-rewrite-maps-in-url-rewrite-module
    • http://technet.microsoft.com/en-us/library/ee215190(v=ws.10).aspx

提交回复
热议问题