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

后端 未结 8 2056
死守一世寂寞
死守一世寂寞 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:18

    The accepted answer works for a single URL or just a few, but my application serves hundreds of domain names (there are far too many URLs to manually enter).

    Here is my IIS7 URL Rewrite Module rule (the action type here is actually a 301 redirect, not a "rewrite"). Works great:

    
      
      
       
      
      
    
    

提交回复
热议问题