以下是关于Yahoo!的3个代码片段,以提高性能!规则:
Disable Etags:
Header unset ETag
FileETag None
Add expire headers:
<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"
Compress plain text file:
<FilesMatch "\\.(js|css|html|htm|php|xml)$">
SetOutputFilter DEFLATE
</FilesMatch>
了解更多关于他们的信息
here.
一
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"
RewriteCond %{HTTP_HOST} !^www\\.domain\\.tld [NC]
RewriteRule ^(.*)$ http://www.domain.tld/$1 [R=301,L]
Block request to xmlrpc.php
仅当您不使用远程发布时使用此选项,因为它可以防止您的博客受到黑客攻击。
RewriteRule ^(.*)xmlrpc\\.php$ http://www.domain.tld [R=301,L]
Redirect all feeds to feedburner
RewriteCond %{HTTP_USER_AGENT} !^.*(FeedBurner|FeedValidator) [NC]
RewriteRule ^feed/?.*$ http://feeds.feedburner.com/feed_uri [R=301,NC,L]