Direct different IP's to different pages on IIS7

前端 未结 1 415
花落未央
花落未央 2021-02-08 17:49

Using IIS7, how do I direct internal private network IP\'s addresses to my web site while I direct external IP addresses to a \"site under maintenance\" page?

So far on

1条回答
  •  孤独总比滥情好
    2021-02-08 18:26

    You can use URL Rewrite (http://www.iis.net/download/URLRewrite) for that. Then you can drop a web.config with the contents like:

    
      ...
      
        
          
            
              
              
                
                
                
              
              
            
          
        
      
      ...
    
    

    What it basically does is to only apply this rule if the content is not already the "site-under-construction" page (to prevent infinite redirects), and only apply this if the IP-address is not coming from 192.168.XXX.XXX (and is not localhost).

    Otherwise it will let them come through to whatever page they requested.

    Note that this should not be use as a security mechanism since Remote Addr could be spoofed, but sounds like for your scenario it should be fine.

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