对于Yahoo !,这是3个片段,可提高性能。规则:
禁用标签:
Header unset ETag
FileETag None
添加到期标头:
<FilesMatch "\.(ico|jpg|jpeg|png|gif|js|css|swf)$">
Header set Expires "Tue, 16 Jun 2020 20:00:00 GMT"
</FilesMatch>
要么
ExpiresActive On
ExpiresByType text/html "access plus 1 day"
ExpiresByType image/gif "access plus 10 years"
ExpiresByType image/jpeg "access plus 10 years"
ExpiresByType image/png "access plus 10 years"
ExpiresByType text/css "access plus 10 years"
ExpiresByType text/javascript "access plus 10 years"
ExpiresByType application/x-javascript "access plus 10 years"
压缩纯文本文件:
<FilesMatch "\.(js|css|html|htm|php|xml)$">
SetOutputFilter DEFLATE
</FilesMatch>
在此处阅读有关它们的更多信息。
更新:
将请求重定向到www域
RewriteCond %{HTTP_HOST} !^www\.domain\.tld [NC]
RewriteRule ^(.*)$ http://www.domain.tld/$1 [R=301,L]
阻止对xmlrpc.php的请求
仅当您不使用远程发布时才使用它,因为它可以防止博客被黑客入侵。
RewriteRule ^(.*)xmlrpc\.php$ http://www.domain.tld [R=301,L]
将所有提要重定向到feedburner
RewriteCond %{HTTP_USER_AGENT} !^.*(FeedBurner|FeedValidator) [NC]
RewriteRule ^feed/?.*$ http://feeds.feedburner.com/feed_uri [R=301,NC,L]