RewriteEngine On RewriteBase / ################ REGLAGES PERSONNALISES ###################### # Reglages pour OVH : # ---------------------------------------------------------------------- SetEnv PHP_VER 5 SetEnv REGISTER_GLOBALS 0 SetEnv ZEND_OPTIMIZER 1 SetEnv SESSION_USE_TRANS_SID 0 # Force the "www." at the beginning of URLs # ---------------------------------------------------------------------- RewriteCond %{HTTP_HOST} !^$ RewriteCond %{HTTP_HOST} !^www\. [NC] RewriteCond %{HTTPS}s ^on(s)| RewriteRule ^ http%1://www.%{HTTP_HOST}%{REQUEST_URI} [R=301,L] # se servir des fichier .gz compressŽ # ---------------------------------------------------------------------- AddType "text/javascript" .gz AddEncoding gzip .gz Header set Vary "Accept-Encoding" AddType "text/css" .gz AddEncoding gzip .gz Header set Vary "Accept-Encoding" #Check to see if browser can accept gzip files. ReWriteCond %{HTTP:accept-encoding} gzip #make sure there's no trailing .gz on the url ReWriteCond %{REQUEST_FILENAME} !^.+\.gz$ #check to see if a .gz version of the file exists. RewriteCond %{REQUEST_FILENAME}.gz -f #All conditions met so add .gz to URL filename (invisibly) RewriteRule ^(.+) $1.gz [QSA,L] # UTF-8 encoding # ---------------------------------------------------------------------- AddDefaultCharset utf-8 AddCharset utf-8 .html .css .js .xml .json .rss .atom # Better website experience for IE users # ---------------------------------------------------------------------- Header set X-UA-Compatible "IE=Edge,chrome=1" Header unset X-UA-Compatible # font-face firefox bug # ---------------------------------------------------------------------- SetEnvIf Origin È "^http(s)?://(.+\.)?(domain1\.org|domain\.com)$" origin_is=$0 Header set Access-Control-Allow-Origin %{origin_is}e env=origin_is # Proper MIME type for all files # ---------------------------------------------------------------------- AddType application/javascript js AddType audio/ogg oga ogg AddType audio/mp4 m4a AddType video/ogg ogv AddType video/mp4 mp4 m4v AddType video/webm webm AddEncoding gzip svgz AddType application/vnd.ms-fontobject eot AddType application/x-font-ttf ttf ttc AddType application/octet-stream .otf .ttf AddType application/x-font-woff woff AddType font/opentype otf AddType font/truetype ttf AddType font/woff woff AddType image/x-icon ico AddType image/webp webp AddType image/svg+xml svg svgz AddType text/cache-manifest appcache manifest AddType text/x-component htc AddType application/x-chrome-extension crx AddType application/x-xpinstall xpi AddType application/octet-stream safariextz AddType text/x-vcard vcf # cache control # ---------------------------------------------------------------------- # BEGIN Expire headers ExpiresActive On ExpiresDefault "access plus 7200 seconds" ExpiresByType image/jpg "access plus 2592000 seconds" ExpiresByType image/jpeg "access plus 2592000 seconds" ExpiresByType image/png "access plus 2592000 seconds" ExpiresByType image/gif "access plus 2592000 seconds" AddType image/x-icon .ico ExpiresByType image/ico "access plus 2592000 seconds" ExpiresByType image/icon "access plus 2592000 seconds" ExpiresByType image/x-icon "access plus 2592000 seconds" ExpiresByType text/css "access plus 2592000 seconds" ExpiresByType text/javascript "access plus 2592000 seconds" ExpiresByType text/html "access plus 7200 seconds" ExpiresByType application/xhtml+xml "access plus 7200 seconds" ExpiresByType application/javascript A259200 ExpiresByType application/x-javascript "access plus 2592000 seconds" ExpiresByType application/x-shockwave-flash "access plus 2592000 seconds" # END Expire headers # BEGIN Cache-Control Headers Header set Cache-Control "max-age=2592000, public" Header set Cache-Control "max-age=2592000, private" Header set Cache-Control "max-age=7200, public" # Disable caching for scripts and other dynamic files Header unset Cache-Control # END Cache-Control Headers # ETag removal # ---------------------------------------------------------------------- FileETag None # FileETag None is not enough for every server. Header unset ETag # Blocking bad bots and site rippers (aka offline browsers) # ---------------------------------------------------------------------- RewriteEngine On RewriteCond %{HTTP_USER_AGENT} ^BlackWidow [OR] RewriteCond %{HTTP_USER_AGENT} ^Bot\ mailto:craftbot@yahoo.com [OR] RewriteCond %{HTTP_USER_AGENT} ^ChinaClaw [OR] RewriteCond %{HTTP_USER_AGENT} ^Custo [OR] RewriteCond %{HTTP_USER_AGENT} ^DISCo [OR] RewriteCond %{HTTP_USER_AGENT} ^Download\ Demon [OR] RewriteCond %{HTTP_USER_AGENT} ^eCatch [OR] RewriteCond %{HTTP_USER_AGENT} ^EirGrabber [OR] RewriteCond %{HTTP_USER_AGENT} ^EmailSiphon [OR] RewriteCond %{HTTP_USER_AGENT} ^EmailWolf [OR] RewriteCond %{HTTP_USER_AGENT} ^Express\ WebPictures [OR] RewriteCond %{HTTP_USER_AGENT} ^ExtractorPro [OR] RewriteCond %{HTTP_USER_AGENT} ^EyeNetIE [OR] RewriteCond %{HTTP_USER_AGENT} ^FlashGet [OR] RewriteCond %{HTTP_USER_AGENT} ^GetRight [OR] RewriteCond %{HTTP_USER_AGENT} ^GetWeb! [OR] RewriteCond %{HTTP_USER_AGENT} ^Go!Zilla [OR] RewriteCond %{HTTP_USER_AGENT} ^Go-Ahead-Got-It [OR] RewriteCond %{HTTP_USER_AGENT} ^GrabNet [OR] RewriteCond %{HTTP_USER_AGENT} ^Grafula [OR] RewriteCond %{HTTP_USER_AGENT} ^HMView [OR] RewriteCond %{HTTP_USER_AGENT} HTTrack [NC,OR] RewriteCond %{HTTP_USER_AGENT} ^Image\ Stripper [OR] RewriteCond %{HTTP_USER_AGENT} ^Image\ Sucker [OR] RewriteCond %{HTTP_USER_AGENT} Indy\ Library [NC,OR] RewriteCond %{HTTP_USER_AGENT} ^InterGET [OR] RewriteCond %{HTTP_USER_AGENT} ^Internet\ Ninja [OR] RewriteCond %{HTTP_USER_AGENT} ^JetCar [OR] RewriteCond %{HTTP_USER_AGENT} ^JOC\ Web\ Spider [OR] RewriteCond %{HTTP_USER_AGENT} ^larbin [OR] RewriteCond %{HTTP_USER_AGENT} ^LeechFTP [OR] RewriteCond %{HTTP_USER_AGENT} ^Mass\ Downloader [OR] RewriteCond %{HTTP_USER_AGENT} ^MIDown\ tool [OR] RewriteCond %{HTTP_USER_AGENT} ^Mister\ PiX [OR] RewriteCond %{HTTP_USER_AGENT} ^Navroad [OR] RewriteCond %{HTTP_USER_AGENT} ^NearSite [OR] RewriteCond %{HTTP_USER_AGENT} ^NetAnts [OR] RewriteCond %{HTTP_USER_AGENT} ^NetSpider [OR] RewriteCond %{HTTP_USER_AGENT} ^Net\ Vampire [OR] RewriteCond %{HTTP_USER_AGENT} ^NetZIP [OR] RewriteCond %{HTTP_USER_AGENT} ^Octopus [OR] RewriteCond %{HTTP_USER_AGENT} ^Offline\ Explorer [OR] RewriteCond %{HTTP_USER_AGENT} ^Offline\ Navigator [OR] RewriteCond %{HTTP_USER_AGENT} ^PageGrabber [OR] RewriteCond %{HTTP_USER_AGENT} ^Papa\ Foto [OR] RewriteCond %{HTTP_USER_AGENT} ^pavuk [OR] RewriteCond %{HTTP_USER_AGENT} ^pcBrowser [OR] RewriteCond %{HTTP_USER_AGENT} ^RealDownload [OR] RewriteCond %{HTTP_USER_AGENT} ^ReGet [OR] RewriteCond %{HTTP_USER_AGENT} ^SiteSnagger [OR] RewriteCond %{HTTP_USER_AGENT} ^SmartDownload [OR] RewriteCond %{HTTP_USER_AGENT} ^SuperBot [OR] RewriteCond %{HTTP_USER_AGENT} ^SuperHTTP [OR] RewriteCond %{HTTP_USER_AGENT} ^Surfbot [OR] RewriteCond %{HTTP_USER_AGENT} ^tAkeOut [OR] RewriteCond %{HTTP_USER_AGENT} ^Teleport\ Pro [OR] RewriteCond %{HTTP_USER_AGENT} ^VoidEYE [OR] RewriteCond %{HTTP_USER_AGENT} ^Web\ Image\ Collector [OR] RewriteCond %{HTTP_USER_AGENT} ^Web\ Sucker [OR] RewriteCond %{HTTP_USER_AGENT} ^WebAuto [OR] RewriteCond %{HTTP_USER_AGENT} ^WebCopier [OR] RewriteCond %{HTTP_USER_AGENT} ^WebFetch [OR] RewriteCond %{HTTP_USER_AGENT} ^WebGo\ IS [OR] RewriteCond %{HTTP_USER_AGENT} ^WebLeacher [OR] RewriteCond %{HTTP_USER_AGENT} ^WebReaper [OR] RewriteCond %{HTTP_USER_AGENT} ^WebSauger [OR] RewriteCond %{HTTP_USER_AGENT} ^Website\ eXtractor [OR] RewriteCond %{HTTP_USER_AGENT} ^Website\ Quester [OR] RewriteCond %{HTTP_USER_AGENT} ^WebStripper [OR] RewriteCond %{HTTP_USER_AGENT} ^WebWhacker [OR] RewriteCond %{HTTP_USER_AGENT} ^WebZIP [OR] RewriteCond %{HTTP_USER_AGENT} ^Wget [OR] RewriteCond %{HTTP_USER_AGENT} ^Widow [OR] RewriteCond %{HTTP_USER_AGENT} ^WWWOFFLE [OR] RewriteCond %{HTTP_USER_AGENT} ^Xaldon\ WebSpider [OR] RewriteCond %{HTTP_USER_AGENT} ^Zeus RewriteRule ^.* - [F,L] ################ GESTIONS DES URLS SPIP ####################### RewriteCond %{QUERY_STRING} action=rss RewriteRule spip.php spip.php?page=rss [QSA,L] RewriteCond %{QUERY_STRING} action=ical RewriteRule spip.php spip.php?page=ical_prive [QSA,L] RewriteCond %{REQUEST_FILENAME} -f RewriteRule "." - [skip=100] RewriteCond %{REQUEST_FILENAME} -d RewriteRule "." - [skip=100] RewriteRule ^rubrique([0-9]+)(\.html)?$ spip.php?page=rubrique&id_rubrique=$1 [QSA,L] RewriteRule ^article([0-9]+)(\.html)?$ spip.php?page=article&id_article=$1 [QSA,L] RewriteRule ^breve([0-9]+)(\.html)?$ spip.php?page=breve&id_breve=$1 [QSA,L] RewriteRule ^mot([0-9]+)(\.html)?$ spip.php?page=mot&id_mot=$1 [QSA,L] RewriteRule ^auteur([0-9]+)(\.html)?$ spip.php?page=auteur&id_auteur=$1 [QSA,L] RewriteRule ^site([0-9]+)(\.html)?$ spip.php?page=site&id_syndic=$1 [QSA,L] RewriteRule ^(rubrique|article|breve|mot|auteur|site|agenda|backend|backend-breves|distrib|forum|ical|plan|recherche|sommaire|sommaire_texte)\.php3?$ spip.php?page=$1 [QSA,L] RewriteRule ^resume.php[3]? spip.php?page=sommaire [QSA,L] RewriteRule ^page.php[3]? spip.php [QSA,L] RewriteRule ^spip_cal\.php3?$ spip.php?page=ical_prive [QSA,L] RewriteRule ^spip_rss\.php3?$ spip.php?page=rss [QSA,L] RewriteRule ^([1-9][0-9]*)$ spip.php?action=redirect&type=article&id=$1 [QSA,L] RewriteRule ^[^\.]+(\.html)?$ spip.php [QSA,E=url_propre:$0,L] # bloquer les acces aux repertoires .svn/ (SPIP, plugins, squelettes...) RewriteRule ^(.*/)?\.svn/ - [F] # Fichiers "standards" (si absents de la racine) RewriteRule ^robots[.]txt$ spip.php?page=robots.txt [QSA,L] RewriteRule ^favicon[.]ico$ spip.php?page=favicon.ico [QSA,L] RewriteRule ^sitemap[.]xml$ spip.php?page=sitemap.xml [QSA,L] ################################# # gestion des erreurs 404 ErrorDocument 404 /spip.php?page=404