################ htacces template CasP spip 3.0.13 ###########
RewriteEngine On
RewriteBase /
################ REGLAGES PERSONNALISES ######################
# Force the "www." at the beginning of URLs #-----------------
RewriteCond %{HTTPS} !=on
RewriteCond %{HTTP_HOST} ^www\.(.+)$ [NC]
RewriteRule ^ http://%1%{REQUEST_URI} [R=301,L]
# Redirection rubrique1 = sommaire #--------------------------
RewriteRule ^spip.php?rubrique1$ /$1 [QSA,R=301,L]
# UTF-8 encoding # -------------------------------------------
AddDefaultCharset utf-8
AddCharset utf-8 .atom .css .js .json .rss .vtt .webapp .xml
# Compression # ----------------------------------------------
SetEnvIfNoCase ^(Accept-EncodXng|X-cept-Encoding|X{15}|~{15}|-{15})$ ^((gzip|deflate)\s*,?\s*)+|[X~-]{4,13}$ HAVE_Accept-Encoding
RequestHeader append Accept-Encoding "gzip,deflate" env=HAVE_Accept-Encoding
AddOutputFilterByType DEFLATE application/atom+xml \
application/javascript \
application/json \
application/rss+xml \
application/vnd.ms-fontobject \
application/x-font-ttf \
application/x-web-app-manifest+json \
application/xhtml+xml \
application/xml \
font/opentype \
image/svg+xml \
image/x-icon \
text/css \
text/html \
text/plain \
text/x-component \
text/xml
# ETag removal # ---------------------------------------------
Header unset ETag
FileETag None
# Caches # ---------------------------------------------------
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 "access plus 2592000 seconds"
ExpiresByType application/x-javascript "access plus 2592000 seconds"
ExpiresByType application/x-shockwave-flash "access plus 2592000 seconds"
Header set Cache-Control "max-age=2592000, public"
Header set Cache-Control "max-age=2592000, private"
Header set Cache-Control "max-age=7200, public"
Header unset Cache-Control
# Proper MIME type for all files # ---------------------------
AddType audio/mp4 m4a f4a f4b
AddType audio/ogg oga ogg
AddType application/javascript js
AddType application/json json
AddType video/mp4 mp4 m4v f4v f4p
AddType video/ogg ogv
AddType video/webm webm
AddType video/x-flv flv
AddType application/font-woff woff
AddType application/vnd.ms-fontobject eot
AddType application/x-font-ttf ttc ttf
AddType font/opentype otf
AddType image/svg+xml svg svgz
AddEncoding gzip svgz
AddType application/octet-stream safariextz
AddType application/x-chrome-extension crx
AddType application/x-opera-extension oex
AddType application/x-shockwave-flash swf
AddType application/x-web-app-manifest+json webapp
AddType application/x-xpinstall xpi
AddType application/xml atom rdf rss xml
AddType image/webp webp
AddType image/x-icon ico
AddType text/cache-manifest appcache manifest
AddType text/vtt vtt
AddType text/x-component htc
AddType text/x-vcard vcf
# Better website experience for IE users # -------------------
Header set X-UA-Compatible "IE=edge"
Header unset X-UA-Compatible
# Allow access from all domains for web fonts # --------------
Header set Access-Control-Allow-Origin "*"
################ 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&status=301&id=$1 [QSA,L]
RewriteRule ^([\w]+)\.api(/(.*))?$ spip.php?action=api_$1&arg=$3 [QSA,L]
RewriteRule ^[^\.]+(\.html)?$ spip.php [QSA,E=url_propre:$0,L]
# trouver fichiers a la racine # -----------------------------
RewriteRule ^robots[.]txt$ spip.php?page=robots.txt [QSA,L]
RewriteRule ^favicon[.]ico$ spip.php?page=favicon.ico [QSA,L]
RewriteRule ^apple-touch-icon[.]png$ spip.php?page=apple-touch-icon.png [QSA,L]
RewriteRule ^sitemap[.]xml$ spip.php?page=sitemap.xml [QSA,L]
# Gestion erreur # -------------------------------------------
ErrorDocument 404 /spip.php?page=404
ExpiresByType text/html "access plus 0 seconds"
# bloque acces .svn/ (SPIP, plugins, squelettes...)# ---------
RewriteRule ^(.*/)?\.svn/ - [F]