ASP.net MVC网站:将所有“非WWW”重定向到要求万维网 [英] ASP.net MVC site : Redirect all "non WWW" request to WWW

查看:64
本文介绍了ASP.net MVC网站:将所有“非WWW”重定向到要求万维网的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

最近我将一个ASP.net站点迁移到ASP.net MVC站点。之前有两个主机标头,一个是mydomain.com,另一个是www.mydomain.com。我的SEO说,您应该只使用一个网址 www.domain.com来获得SEO优势。

Recently I migrated an ASP.net site to ASP.net MVC site. Earlier there were two host headers one mydomain.com and another is www.mydomain.com. My SEO says you should use only one url "www.domain.com" for SEO advantage.

我正在寻找一种可以对所有mydomain.com进行301永久重定向的选项请求到www.mydomain.com。

I am looking for an option to do 301 permanent redirect all mydomain.com request to www.mydomain.com.

该站点托管在IIS6中,并在ASP.net MVC 4中开发。

The site is hosted in IIS6 and developed in ASP.net MVC 4.

推荐答案

不幸的是, URL重写模块不适用于IIS6 (仅IIS7或更高版本)。您是否考虑过创建自己的HttpModule,像这样?

Unfortunately, the URL rewrite module does not work with IIS6 (only IIS7 or greater). Have you considered creating your own HttpModule, something like this this?

IIS 6如何从http://example.com/*重定向到http:// www。 example.com/*

或者您可能会使用第三方解决方案,例如以下一种:

Or you could potentially use a 3rd party solution like one of these:

http://iirf.codeplex.com/

http://www.urlrewriting.net/149/en/home .html

http:// www。 isapirewrite.com/

http:// urlrewriter。净/

这篇关于ASP.net MVC网站:将所有“非WWW”重定向到要求万维网的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆