什么是一个相当容易实现URL重写的Asp.Net MVC [英] What is a fairly easy to implement Url Rewriter for Asp.Net MVC

查看:209
本文介绍了什么是一个相当容易实现URL重写的Asp.Net MVC的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我重写一些网站的MVC。

I am rewriting some of sites in MVC.

我关心旧链接在那里,有的我知道,有的我不知道。

I am concerned about old links out there, some I know about and some I don't.

我要寻找的建议和code样品就如何确保我的已知和未知的环节都没有死。 什么是你的选择是什么?

I am looking for suggestions and code sample on how to make sure that my known and unknown links are not dead. What are your choices?

我希望最终淘汰我的旧链接。我希望通过我的通知,从用户对新老链接的链接来做到这一点。

I would eventually like to phase out my old links. I hope to do this by notifying my users coming from old links about the new links.

我想简单的东西开始,因为我仍然在学习MVC。

I want to start off with something simple, as I am still learning MVC.

另一篇文章建议管理融合的URL重写和反向代理

推荐答案

我是你提到的URL重写的开发商。如果您想帮助,请在readme.txt文件中提出与我联系。你所要求的,是不寻常的,可以使用一些非常基本的规则很容易地完成。

I am the developer of the URL Rewriter you mentioned. If you would like help, please contact me as suggested in the ReadMe.txt file. What you are asking for is not out of the ordinary and can be easily accomplished using some very basic rules.

嗯,你提出了两个重要的点。你要通知用户有关新的链接,你可能在这个时候在乎你最大的用户是谷歌。你可以做一个 301永久重定向解决与谷歌这个问题。例如,这是你将如何使用URL重写语法做到这一点。

Well you brought up two important points. You want to notify your users about the new links, you biggest user your probably care about at this time is Google. You can address this concern with Google by doing a 301 Permanent Redirect. For example, this is how you would do it with the URL Rewriter syntax.

RewriteRule ^/(old-url.*)$    /new-url$1  [R=301]

R = 301 是否永久重定向。第二的已知和未知的联系。为了您的知名链接,您只需将它们映射到使用上述规则的新应用程序的正确部分。取决于有多少旧的URL,你有你可能想使重写规则通用的,所以人会赶上许多老的URL。

The R=301 does the permanent redirect. The second your known and unknown links. For your known links you just need to map them to the correct part of your new application using the above rules. Depending on how many old url's you have you probably want to make the rewrite rule generic so one will catch many old url's.

有关你可能想要做的两件事之一的不明链接,查看你的服务器日志或分析任何东西重要,并正确地映射那些新的code的正确部分。

For the unknown links you probably want to do one of two things, look over your server logs or analytics for anything important, and map those as appropriately to the correct part of your new code.

然后,以确保所有的人都没有完全消失,你可以重定向他们要么你的主页,内部网站搜索,或者只是一个普通的网页解释说,您的网站已经更新,这种联系是不再使用

Then to make sure all the others don't totally go away you can redirect them to either your home page, internal site search, or just a generic page explaining that your site has been updated and this link is no longer in use.

再请及时与问题,与我联系。该管理融合的URL重写和反向代理将在IIS上与任何.NET网站(包括MVC)很好地工作6和IIS 7包括PHP,Ruby的,JSP和ASP经典

Again please contact me with questions. The Managed Fusion URL Rewriter and Reverse Proxy will work perfectly with any .NET website (including MVC) on IIS 6 and any type of website on IIS 7 including PHP, Ruby, JSP, and Classic ASP.

这篇关于什么是一个相当容易实现URL重写的Asp.Net MVC的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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