performance - 目录斜杠重定向?这还会发生吗?

标签 performance redirect

我在看一篇文章referenced by Jeff Atwood关于 Yahoo's "Best Practices" for speeding up a website ,我注意到了这个小 gem :

One of the most wasteful redirects happens frequently and web developers are generally not aware of it. It occurs when a trailing slash (/) is missing from a URL that should otherwise have one. For example, going to http://astrology.yahoo.com/astrology results in a 301 response containing a redirect to http://astrology.yahoo.com/astrology/ (notice the added trailing slash). This is fixed in Apache by using Alias or mod_rewrite, or the DirectorySlash directive if you're using Apache handlers.



这还会发生吗?随着网络的发展,这篇文章已经很老了。我想我多年来一直在这样做。我想我最近没有注意到这种情况发生,但话说回来,我从来没有真正看过。这是 Apache 的东西吗? IIS 7 会这样做吗?

我很害怕。抱着我。

最佳答案

尝试一下!

以下是一些从终端运行的截断请求。

curl -I  http://astrology.yahoo.com/astrology

HTTP/1.0 301 Moved Permanently
Date: Tue, 21 Jun 2011 13:24:24 GMT
Location: http://shine.yahoo.com/astrology/


curl -I http://wordpress.org/extend

HTTP/1.0 301 Moved Permanently
Server: nginx
Date: Tue, 21 Jun 2011 13:26:17 GMT
Location: http://wordpress.org/extend/

尽管 IIS 似乎以另一种方式做到了:
curl -I http://www.iis.net/overview

HTTP/1.0 200 OK
Server: Microsoft-IIS/7.0

curl -I http://www.iis.net/overview/

HTTP/1.0 301 Moved Permanently
Location: http://www.iis.net/overview

猜猜这取决于您如何配置它,但这绝对是需要优化的东西。

关于performance - 目录斜杠重定向?这还会发生吗?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/6425929/

相关文章:

javascript - Android 性能在高于 2.3.5 (phonegap/cordova) 的更高版本上受到影响

php - laravel 中的重定向循环

java - 如何更改redirect.jsp以查看我的自定义jsp页面而不是index.jsp

PHP 重定向而不保存在历史记录中

PHP 脚本更新所有用户值而不是单个用户值

sql - 从一张表中获取交叉数据的最佳方法是什么?

performance - python : Is there a way to keep an automatic conversion from int to long int from happening?

linux - Linux 中的中断延迟

redirect - (如何)我应该从我的默认日历页面重定向用户?

android - 慢 Android Studio 1.3