How to redirect with “www” URL's to without “www” URL's or vice-versa?

后端 未结 8 2078
死守一世寂寞
死守一世寂寞 2020-12-08 05:15

I am using ASP.NET 2.0 C#. I want to redirect all request for my web app with \"www\" to without \"www\"

www.example.com to example.com

Or

example.co

8条回答
  •  余生分开走
    2020-12-08 06:20

    There's a Stackoverflow blog post about this.

    http://blog.stackoverflow.com/2008/06/dropping-the-www-prefix/

    Quoting Jeff:

    Here’s the IIS7 rule to remove the WWW prefix from all incoming URLs. Cut and paste this XML fragment into your web.config file under

     /  / 
    
    
    
    
    
    
    
    
    

    Or, if you prefer to use the www prefix, you can do that too:

    
    
    
    
    
    
    
    

提交回复
热议问题