用PHP实现HTTP 301永久重定向

301,302 都是HTTP状态的编码,都代表着某个URL发生了转移,不同之处在于:301 代表永久性转移(Permanently Moved),302 代表暂时性转移(Temporarily Moved)。

  301 重定向是网页更改地址后对搜索引擎友好的最好方法,只要不是暂时搬移的情况,都建议使用301来做转址,如果我们把一个地址采用301跳转方式跳转的话,搜索引擎会把老地址的PageRank等信息带到新地址,同时在搜索引擎索引库中彻底废弃掉原先的老地址。

  在PHP中,一般实现页面跳转的语句如下:

php header(’Location: http://www.wuwx.cn/’);

  当我们使用工具查看这个HTTP头,发现他返回的是一个HTTP 302临时重定向。而不是我们所期望的HTTP 301永久重定向,注意看下图中的第一行:

应该如何实现HTTP 301永久重定向呢?其实也很简单,只需增加一行代码:

php header(’HTTP/1.1 301 Moved Permanently’);

header(’Location: http://www.wuwx.cn/’);

  当我们再次查看这个页面的HTTP头的时候,他返回的就是我们所期望的HTTP 301永久重定向了。

波比源码 – 精品源码模版分享 | www.bobi11.com
1. 本站所有资源来源于用户上传和网络,如有侵权请邮件联系站长!
2. 分享目的仅供大家学习和交流,您必须在下载后24小时内删除!
3. 不得使用于非法商业用途,不得违反国家法律。否则后果自负!
4. 本站提供的源码、模板、插件等等其他资源,都不包含技术服务请大家谅解!
5. 如有链接无法下载、失效或广告,请联系管理员处理!
6. 本站资源售价只是赞助,收取费用仅维持本站的日常运营所需!
7. 本站源码并不保证全部能正常使用,仅供有技术基础的人学习研究,请谨慎下载
8. 如遇到加密压缩包,请使用WINRAR解压,如遇到无法解压的请联系管理员!

波比源码 » 用PHP实现HTTP 301永久重定向

95 评论

  1. levitra online buy levitra sale buy methylprednisolone us

  2. purchase triamcinolone without prescription claritin drug buy clarinex pills

  3. order clarithromycin 500mg pill clonidine online meclizine 25mg sale

  4. cheap indocin 50mg cenforce drug buy generic cenforce 50mg

  5. purchase accutane without prescription buy acillin generic ampicillin buy online

  6. buy generic provigil 100mg metoprolol sale order lopressor 50mg pills

  7. atorvastatin 20mg oral sildenafil 50mg buy sildenafil tablets

  8. order tadalafil 10mg sale cialis us ed pills gnc

  9. praziquantel 600mg without prescription microzide for sale periactin order online

  10. lyrica 75mg over the counter order priligy buy priligy 30mg online cheap

  11. buy plavix 75mg generic plavix tablet ketoconazole over the counter

  12. buy simvastatin medication zocor 10mg canada viagra 50mg over the counter

  13. tadalafil 10mg sale cialis 5mg us real viagra pills

  14. avanafil order online buy avana pill purchase voltaren sale

  15. indocin 75mg for sale suprax cost purchase suprax pill

  16. accutane 20mg brand amoxicillin ca purchase azithromycin without prescription

  17. how to get vardenafil without a prescription generic tizanidine order plaquenil 400mg without prescription

  18. order ramipril 10mg without prescription etoricoxib brand arcoxia 60mg brand

发表评论

Hi, 如果你对这款模板有疑问,可以跟我联系哦!

联系站长
赞助VIP 享更多特权,建议使用 QQ 登录
喜欢我嘛?喜欢就按“ctrl+D”收藏我吧!♡