【发布时间】:2013-02-23 22:22:32
【问题描述】:
我想这可能是一个新手问题(我是谁 :))。 在将用户重定向到自定义错误页面时,例如404,表示没有找到该页面,这个重定向的类型是302。
<error statusCode="404" redirect="/Utility/Error404.aspx" />
<error statusCode="400" redirect="/Utility/Error404.aspx" />
是否可以通过 Web.config 进行此重定向 301?
在此先感谢各位代码狂人。
【问题讨论】:
-
您应该小心 301,因为某些客户端会更新他们存储的链接。这可能意味着导致 404 的临时故障(可能是在手动发布期间?)将永久破坏他们的链接。来自 rfc2616
The requested resource has been assigned a new permanent URI and any future references to this resource SHOULD use one of the returned URIs. Clients with link editing capabilities ought to automatically re-link references to the Request-URI to one or more of the new references returned by the server, where possible. This response is cacheable unless indicated otherwise.
标签: asp.net .net web-config