.htaccess 11 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296
  1. #
  2. # Apache/PHP/Drupal settings:
  3. #
  4. # Protect files and directories from prying eyes.
  5. <FilesMatch "\.(engine|inc|info|install|make|module|profile|test|po|sh|.*sql|theme|tpl(\.php)?|xtmpl)(~|\.sw[op]|\.bak|\.orig|\.save)?$|^(\..*|Entries.*|Repository|Root|Tag|Template)$|^#.*#$|\.php(~|\.sw[op]|\.bak|\.orig\.save)$">
  6. Order allow,deny
  7. </FilesMatch>
  8. # Don't show directory listings for URLs which map to a directory.
  9. Options -Indexes
  10. # Follow symbolic links in this directory.
  11. Options +FollowSymLinks
  12. # Make Drupal handle any 404 errors.
  13. ErrorDocument 404 /index.php
  14. # Set the default handler.
  15. DirectoryIndex index.php index.html index.htm
  16. # Override PHP settings that cannot be changed at runtime. See
  17. # sites/default/default.settings.php and drupal_environment_initialize() in
  18. # includes/bootstrap.inc for settings that can be changed at runtime.
  19. # PHP 5, Apache 1 and 2.
  20. <IfModule mod_php5.c>
  21. php_flag magic_quotes_gpc off
  22. php_flag magic_quotes_sybase off
  23. php_flag register_globals off
  24. php_flag session.auto_start off
  25. php_value mbstring.http_input pass
  26. php_value mbstring.http_output pass
  27. php_flag mbstring.encoding_translation off
  28. </IfModule>
  29. # Requires mod_expires to be enabled.
  30. <IfModule mod_expires.c>
  31. # Enable expirations.
  32. ExpiresActive On
  33. # Cache all files for 2 weeks after access (A).
  34. ExpiresDefault A1209600
  35. <FilesMatch \.php$>
  36. # Do not allow PHP scripts to be cached unless they explicitly send cache
  37. # headers themselves. Otherwise all scripts would have to overwrite the
  38. # headers set by mod_expires if they want another caching behavior. This may
  39. # fail if an error occurs early in the bootstrap process, and it may cause
  40. # problems if a non-Drupal PHP file is installed in a subdirectory.
  41. ExpiresActive Off
  42. </FilesMatch>
  43. </IfModule>
  44. # Various rewrite rules.
  45. <IfModule mod_rewrite.c>
  46. RewriteEngine on
  47. # Set "protossl" to "s" if we were accessed via https://. This is used later
  48. # if you enable "www." stripping or enforcement, in order to ensure that
  49. # you don't bounce between http and https.
  50. RewriteRule ^ - [E=protossl]
  51. RewriteCond %{HTTPS} on
  52. RewriteRule ^ - [E=protossl:s]
  53. # Make sure Authorization HTTP header is available to PHP
  54. # even when running as CGI or FastCGI.
  55. RewriteRule ^ - [E=HTTP_AUTHORIZATION:%{HTTP:Authorization}]
  56. # Block access to "hidden" directories whose names begin with a period. This
  57. # includes directories used by version control systems such as Subversion or
  58. # Git to store control files. Files whose names begin with a period, as well
  59. # as the control files used by CVS, are protected by the FilesMatch directive
  60. # above.
  61. #
  62. # NOTE: This only works when mod_rewrite is loaded. Without mod_rewrite, it is
  63. # not possible to block access to entire directories from .htaccess, because
  64. # <DirectoryMatch> is not allowed here.
  65. #
  66. # If you do not have mod_rewrite installed, you should remove these
  67. # directories from your webroot or otherwise protect them from being
  68. # downloaded.
  69. RewriteRule "(^|/)\." - [F]
  70. # If your site can be accessed both with and without the 'www.' prefix, you
  71. # can use one of the following settings to redirect users to your preferred
  72. # URL, either WITH or WITHOUT the 'www.' prefix. Choose ONLY one option:
  73. #
  74. # To redirect all users to access the site WITH the 'www.' prefix,
  75. # (http://example.com/... will be redirected to http://www.example.com/...)
  76. # uncomment the following:
  77. # RewriteCond %{HTTP_HOST} .
  78. # RewriteCond %{HTTP_HOST} !^www\. [NC]
  79. # RewriteRule ^ http%{ENV:protossl}://www.%{HTTP_HOST}%{REQUEST_URI} [L,R=301]
  80. # To redirect all users to access the site WITHOUT the 'www.' prefix,
  81. # (http://www.example.com/... will be redirected to http://example.com/...)
  82. # uncomment the following:
  83. # RewriteCond %{HTTP_HOST} ^www\.(.+)$ [NC]
  84. # RewriteRule ^ http%{ENV:protossl}://%1%{REQUEST_URI} [L,R=301]
  85. # redirect all materiau domains to materio.com
  86. RewriteCond %{HTTP_HOST} ^basebeta\.materio\.com [OR]
  87. RewriteCond %{HTTP_HOST} ^www\.materio\.fr [OR]
  88. RewriteCond %{HTTP_HOST} ^materio\.fr [OR]
  89. RewriteCond %{HTTP_HOST} ^www\.materio\.net [OR]
  90. RewriteCond %{HTTP_HOST} ^materio\.net [OR]
  91. RewriteCond %{HTTP_HOST} ^www\.materio\.eu [OR]
  92. RewriteCond %{HTTP_HOST} ^materio\.eu [OR]
  93. RewriteCond %{HTTP_HOST} ^www\.materio\.com
  94. # RewriteRule ^ http%{ENV:protossl}://materio.com%{REQUEST_URI} [L,R=301]
  95. RewriteRule ^ https://materio.com%{REQUEST_URI} [L,R=301]
  96. # Redirect to HTTPS
  97. # RewriteCond %{HTTPS} off
  98. # RewriteCond %{HTTP:X-Forwarded-Proto} !https
  99. # RewriteRule ^(.*)$ https://%{HTTP_HOST}%{REQUEST_URI} [L,R=301]
  100. # Modify the RewriteBase if you are using Drupal in a subdirectory or in a
  101. # VirtualDocumentRoot and the rewrite rules are not working properly.
  102. # For example if your site is at http://example.com/drupal uncomment and
  103. # modify the following line:
  104. # RewriteBase /drupal
  105. #
  106. # If your site is running in a VirtualDocumentRoot at http://example.com/,
  107. # uncomment the following line:
  108. RewriteBase /
  109. # Pass all requests not referring directly to files in the filesystem to
  110. # index.php. Clean URLs are handled in drupal_environment_initialize().
  111. RewriteCond %{REQUEST_FILENAME} !-f
  112. RewriteCond %{REQUEST_FILENAME} !-d
  113. RewriteCond %{REQUEST_URI} !=/favicon.ico
  114. RewriteRule ^ index.php [L]
  115. # Rules to correctly serve gzip compressed CSS and JS files.
  116. # Requires both mod_rewrite and mod_headers to be enabled.
  117. <IfModule mod_headers.c>
  118. # Serve gzip compressed CSS files if they exist and the client accepts gzip.
  119. RewriteCond %{HTTP:Accept-encoding} gzip
  120. RewriteCond %{REQUEST_FILENAME}\.gz -s
  121. RewriteRule ^(.*)\.css $1\.css\.gz [QSA]
  122. # Serve gzip compressed JS files if they exist and the client accepts gzip.
  123. RewriteCond %{HTTP:Accept-encoding} gzip
  124. RewriteCond %{REQUEST_FILENAME}\.gz -s
  125. RewriteRule ^(.*)\.js $1\.js\.gz [QSA]
  126. # Serve correct content types, and prevent mod_deflate double gzip.
  127. RewriteRule \.css\.gz$ - [T=text/css,E=no-gzip:1]
  128. RewriteRule \.js\.gz$ - [T=text/javascript,E=no-gzip:1]
  129. <FilesMatch "(\.js\.gz|\.css\.gz)$">
  130. # Serve correct encoding type.
  131. Header set Content-Encoding gzip
  132. # Force proxies to cache gzipped & non-gzipped css/js files separately.
  133. Header append Vary Accept-Encoding
  134. </FilesMatch>
  135. </IfModule>
  136. </IfModule>
  137. # Add headers to all responses.
  138. <IfModule mod_headers.c>
  139. # Disable content sniffing, since it's an attack vector.
  140. Header always set X-Content-Type-Options nosniff
  141. </IfModule>
  142. # from boiler plate V5.02
  143. # ######################################################################
  144. # # MEDIA TYPES AND CHARACTER ENCODINGS #
  145. # ######################################################################
  146. # ----------------------------------------------------------------------
  147. # | Media types |
  148. # ----------------------------------------------------------------------
  149. # Serve resources with the proper media types (f.k.a. MIME types).
  150. #
  151. # https://www.iana.org/assignments/media-types/media-types.xhtml
  152. # https://httpd.apache.org/docs/current/mod/mod_mime.html#addtype
  153. <IfModule mod_mime.c>
  154. # Data interchange
  155. AddType application/atom+xml atom
  156. AddType application/json json map topojson
  157. AddType application/ld+json jsonld
  158. AddType application/rss+xml rss
  159. AddType application/vnd.geo+json geojson
  160. AddType application/xml rdf xml
  161. # JavaScript
  162. # Normalize to standard type.
  163. # https://tools.ietf.org/html/rfc4329#section-7.2
  164. AddType application/javascript js
  165. # Manifest files
  166. AddType application/manifest+json webmanifest
  167. AddType application/x-web-app-manifest+json webapp
  168. AddType text/cache-manifest appcache
  169. # Media files
  170. AddType audio/mp4 f4a f4b m4a
  171. AddType audio/ogg oga ogg opus
  172. AddType image/bmp bmp
  173. AddType image/svg+xml svg svgz
  174. AddType image/webp webp
  175. AddType video/mp4 f4v f4p m4v mp4
  176. AddType video/ogg ogv
  177. AddType video/webm webm
  178. AddType video/x-flv flv
  179. # Serving `.ico` image files with a different media type
  180. # prevents Internet Explorer from displaying then as images:
  181. # https://github.com/h5bp/html5-boilerplate/commit/37b5fec090d00f38de64b591bcddcb205aadf8ee
  182. AddType image/x-icon cur ico
  183. # Web fonts
  184. AddType application/font-woff woff
  185. AddType application/font-woff2 woff2
  186. AddType application/vnd.ms-fontobject eot
  187. # Browsers usually ignore the font media types and simply sniff
  188. # the bytes to figure out the font type.
  189. # https://mimesniff.spec.whatwg.org/#matching-a-font-type-pattern
  190. #
  191. # However, Blink and WebKit based browsers will show a warning
  192. # in the console if the following font types are served with any
  193. # other media types.
  194. AddType application/x-font-ttf ttc ttf
  195. AddType font/opentype otf
  196. # Other
  197. AddType application/octet-stream safariextz
  198. AddType application/x-bb-appworld bbaw
  199. AddType application/x-chrome-extension crx
  200. AddType application/x-opera-extension oex
  201. AddType application/x-xpinstall xpi
  202. AddType text/vcard vcard vcf
  203. AddType text/vnd.rim.location.xloc xloc
  204. AddType text/vtt vtt
  205. AddType text/x-component htc
  206. </IfModule>
  207. # ----------------------------------------------------------------------
  208. # | Character encodings |
  209. # ----------------------------------------------------------------------
  210. # Serve all resources labeled as `text/html` or `text/plain`
  211. # with the media type `charset` parameter set to `UTF-8`.
  212. #
  213. # https://httpd.apache.org/docs/current/mod/core.html#adddefaultcharset
  214. AddDefaultCharset utf-8
  215. # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
  216. # Serve the following file types with the media type `charset`
  217. # parameter set to `UTF-8`.
  218. #
  219. # https://httpd.apache.org/docs/current/mod/mod_mime.html#addcharset
  220. <IfModule mod_mime.c>
  221. AddCharset utf-8 .atom \
  222. .bbaw \
  223. .css \
  224. .geojson \
  225. .js \
  226. .json \
  227. .jsonld \
  228. .manifest \
  229. .rdf \
  230. .rss \
  231. .topojson \
  232. .vtt \
  233. .webapp \
  234. .webmanifest \
  235. .xloc \
  236. .xml
  237. </IfModule>