我正在阅读关于 Yahoo’s “Best Practices” for speeding up a website的文章 referenced by Jeff Atwood,我注意到这个小宝石: One of the most wasteful redirects happens frequently and web developers are generally not awar
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
07002
results in a 301 response containing a
redirect to
07003
(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
猜猜这取决于你如何配置它,但它绝对是优化的东西.