域名更改-如何使用ASP MVC 4重定向 [英] Domain name changes - how to redirect with ASP MVC 4

查看:64
本文介绍了域名更改-如何使用ASP MVC 4重定向的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我们已经将域名从old.com更改为new.com,并在old.com上放置了一个新的ASP MVC 4网站

we have change our domain name from old.com to new.com and put a new ASP MVC 4 web site on old.com

由于搜索引擎仍然指向old.com,因此我们希望将一些网址重定向到新网址.

Because search engine still point to old.com we would like to redirect some urls to the new one.

利用ASP MVC管道以重定向答案进行响应的可能方法是什么?

What is the possible ways to tap into ASP MVC pipeline to respond with redirect answer?

谢谢你,伊豆.

推荐答案

HTTP响应状态代码301已永久移动用于永久重定向.

The HTTP response status code 301 Moved Permanently is used for permanent redirection.

Google建议使用301重定向将网页的网址更改为它显示在搜索引擎结果中.

Google recommends using a 301 redirect to change the URL of a page as it is shown in search engine results.

根据此问题此处您有2个选择:

According to this question here you have 2 options:

  1. 在IIS7中安装HTTP重定向功能.

  1. Installing the HTTP Redirect feature in IIS7.

在应用程序级别执行重定向(使用Global.asax的Application_BeginRequest).

Do redirection at application level (using Application_BeginRequest at Global.asax).

这篇关于域名更改-如何使用ASP MVC 4重定向的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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