remove 'WWW' in ASP.NET MVC 1.0

前端 未结 4 1313
被撕碎了的回忆
被撕碎了的回忆 2021-02-11 04:14

I am attempting to force the domain name to not use the \'www\'. I want to redirect the user if attempted. I have seen very little on an MVC solution. Is there anyway to harness

4条回答
  •  被撕碎了的回忆
    2021-02-11 04:21

    Although I believe John Gietzen's answer is the most elegant solution, I was unable to implement do to a shared hosting environment. Determined to find a non-application driven solution I found this blog post which shows a good alternative method for IIS7. Thankfully DiscountASP.NET's has the URL Rewrite module available through the IIS Manager tool.

    Following this blog post on creating a rewrite rule any URL with www in the domain will do a permanent 301 redirect to the non-www site. All while preserving the full paths.

    Thanks for everyone's input.

提交回复
热议问题