Ray's playground

 

Rule 11: Avoid Redirects(Chapter 11 of High performance Web Sites)

  A redirect is used to reroute users from one URL to another.There are different kinds
of redirects—301 and 302 are the most popular.Redirects are usually done for
HTML documents, but they may also be used when requesting components in the
page (images, scripts, etc.). There are different reasons for implementing redirects,
including web site redesign, tracking traffic flow, counting ad impressions, and creating
URLs that are easier for users to remember.We’ll examine all of these aspects in
this chapter, but the main thing to remember is that redirects make your pages
slower.

• 300 Multiple Choices (based on Content-Type)
• 301 Moved Permanently
• 302 Moved Temporarily (a.k.a. Found)
• 303 See Other (clarification of 302)
• 304 Not Modified
• 305 Use Proxy
• 306 (no longer used)
• 307 Temporary Redirect (clarification of 302)

  The key is to find a way to have these simpler URLs without the redirects.Rather
than forcing users to undergo an additional HTTP request, it would be better to
avoid the redirect using Alias, mod_rewrite, DirectorySlash, and directly linking
code, as described in the earlier section “Connecting Web Sites.”

posted on 2009-12-13 13:56  Ray Z  阅读(218)  评论(0编辑  收藏  举报

导航