htaccess站点优化
Posted
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了htaccess站点优化相关的知识,希望对你有一定的参考价值。
### Translation proposed by Google Options +FollowSymlinks RewriteEngine on RewriteRule ^(.*)/en$ http://translate.google.com/translate?hl=en&sl=fr&tl=en&u=http://votresite.net/$1 [R,NC] RewriteRule ^(.*)/de$ http://translate.google.com/translate?hl=de&sl=fr&tl=de&u=http://votresite.net/$1 [R,NC] ### Download without window dialog AddType application/octet-stream .pdf AddType application/octet-stream .zip AddType application/octet-stream .mov ### Compress files AddOutputFilterByType DEFLATE text/plain AddOutputFilterByType DEFLATE text/html AddOutputFilterByType DEFLATE text/xml AddOutputFilterByType DEFLATE text/css AddOutputFilterByType DEFLATE application/javascript AddOutputFilterByType DEFLATE application/x-javascript AddOutputFilterByType DEFLATE application/xml AddOutputFilterByType DEFLATE application/xhtml+xml AddOutputFilterByType DEFLATE application/rss+xml <IfModule mod_gzip.c> mod_gzip_on Yes mod_gzip_dechunk Yes mod_gzip_item_include file .(html?|txt|css|js|php|pl)$ mod_gzip_item_include handler ^cgi-script$ mod_gzip_item_include mime ^text/.* mod_gzip_item_include mime ^application/x-javascript.* mod_gzip_item_exclude mime ^image/.* mod_gzip_item_exclude rspheader ^Content-Encoding:.*gzip.* </IfModule> ### Put files in cache <FilesMatch ".(flv|gif|jpg|jpeg|png|ico|swf|js|css|pdf)$"> Header set Cache-Control "max-age=2592000" </FilesMatch> ### Protect pictures from HOTLINKING RewriteEngine on RewriteCond %{HTTP_REFERER} !^http://(www.)?domain.net/.*$ [NC] RewriteCond %{HTTP_REFERER} ^http://(www.)?site-voleur-qui-hotlink.com/.*$ [NC] RewriteCond %{REQUEST_FILENAME} !/images/divers/grille.jpg$ [NC] RewriteRule .(gif|jpg|jpeg|png)$ /images/divers/grille.jpg [R,L]
以上是关于htaccess站点优化的主要内容,如果未能解决你的问题,请参考以下文章