开发者

asp.net mvc 2.0 - 301 permanent direct

I've seen a few similar questions to mine but not exactly what I'm after.

this question shows me how to do the r开发者_如何学Pythonedirect but where/how do I put the extra information in the redirect to tell the search engines that it is a 301?

ASP.Net MVC - Trapping certain URL's to do 301 Redirect


You could try something like this:

public ActionResult Home() {
    Response.Status = "301 Moved Permanently";
    Response.RedirectLocation = "/";
    Response.End();
    return Redirect("~/");
}

This works for one off. If you have multiples, then you'll want to come up with some sort of handler.

One such handler I've used is Legacy Routing. It worked out quite well for me.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜