Return to Snippet

Revision: 36151
at November 18, 2010 22:17 by NiReiC


Initial Code
### 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]

Initial URL
http://www.lafermeduweb.net/billet/-htaccess-quelques-astuces-bien-pratiques-a-connaitre-981.html

Initial Description

                                

Initial Title
htaccess site optimizing

Initial Tags
htaccess, apache

Initial Language
Apache