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.”

转载于:https://www.cnblogs.com/zhtf2014/archive/2009/12/13/1622982.html

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值