.htaccess 9.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258
  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)$|^(\..*|Entries.*|Repository|Root|Tag|Template)$">
  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_initialize_variables() 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. # Block access to "hidden" directories whose names begin with a period. This
  48. # includes directories used by version control systems such as Subversion or
  49. # Git to store control files. Files whose names begin with a period, as well
  50. # as the control files used by CVS, are protected by the FilesMatch directive
  51. # above.
  52. #
  53. # NOTE: This only works when mod_rewrite is loaded. Without mod_rewrite, it is
  54. # not possible to block access to entire directories from .htaccess, because
  55. # <DirectoryMatch> is not allowed here.
  56. #
  57. # If you do not have mod_rewrite installed, you should remove these
  58. # directories from your webroot or otherwise protect them from being
  59. # downloaded.
  60. RewriteRule "(^|/)\." - [F]
  61. # redirect all materiau domains to materio.com
  62. RewriteCond %{HTTPS} off
  63. RewriteCond %{HTTP_HOST} ^basebeta\.materio\.com [OR]
  64. RewriteCond %{HTTP_HOST} ^materio\.com [OR]
  65. RewriteCond %{HTTP_HOST} ^www\.materio\.fr [OR]
  66. RewriteCond %{HTTP_HOST} ^materio\.fr [OR]
  67. RewriteCond %{HTTP_HOST} ^www\.materio\.net [OR]
  68. RewriteCond %{HTTP_HOST} ^materio\.net [OR]
  69. RewriteCond %{HTTP_HOST} ^www\.materio\.eu [OR]
  70. RewriteCond %{HTTP_HOST} ^materio\.eu
  71. RewriteRule ^ http://www.materio.com%{REQUEST_URI} [L,R=301]
  72. # SSL
  73. RewriteCond %{HTTPS} off
  74. RewriteRule ^(.*)$ https://www.materio.com/$1 [L,R=301]
  75. # If your site can be accessed both with and without the 'www.' prefix, you
  76. # can use one of the following settings to redirect users to your preferred
  77. # URL, either WITH or WITHOUT the 'www.' prefix. Choose ONLY one option:
  78. #
  79. # To redirect all users to access the site WITH the 'www.' prefix,
  80. # (http://example.com/... will be redirected to http://www.example.com/...)
  81. # uncomment the following:
  82. # RewriteCond %{HTTP_HOST} !^www\. [NC]
  83. # RewriteRule ^ http://www.%{HTTP_HOST}%{REQUEST_URI} [L,R=301]
  84. #
  85. # To redirect all users to access the site WITHOUT the 'www.' prefix,
  86. # (http://www.example.com/... will be redirected to http://example.com/...)
  87. # uncomment the following:
  88. # RewriteCond %{HTTP_HOST} ^www\.(.+)$ [NC]
  89. # RewriteRule ^ http://%1%{REQUEST_URI} [L,R=301]
  90. # Modify the RewriteBase if you are using Drupal in a subdirectory or in a
  91. # VirtualDocumentRoot and the rewrite rules are not working properly.
  92. # For example if your site is at http://example.com/drupal uncomment and
  93. # modify the following line:
  94. # RewriteBase /drupal
  95. #
  96. # If your site is running in a VirtualDocumentRoot at http://example.com/,
  97. # uncomment the following line:
  98. RewriteBase /
  99. # Pass all requests not referring directly to files in the filesystem to
  100. # index.php. Clean URLs are handled in drupal_environment_initialize().
  101. RewriteCond %{REQUEST_FILENAME} !-f
  102. RewriteCond %{REQUEST_FILENAME} !-d
  103. RewriteCond %{REQUEST_URI} !=/favicon.ico
  104. RewriteRule ^ index.php [L]
  105. ## local
  106. # RewriteCond %{REMOTE_ADDR} !^127\.0\.0\.1
  107. ## maison quentin
  108. # RewriteCond %{REMOTE_ADDR} !^86\.68\.188\.175
  109. ## materio
  110. # RewriteCond %{REMOTE_ADDR} !^212\.198\.136\.215
  111. ## maison bach
  112. # RewriteCond %{REMOTE_ADDR} !^82\.230\.62\.145
  113. # RewriteRule !maintenance http://www.materio.com/maintenance [L,R=302,E=nocache:1]
  114. ## http://mark.koli.ch/2010/12/set-cache-control-and-expires-headers-on-a-redirect-with-mod-rewrite.html
  115. ## Set the response header if the "nocache" environment variable is set
  116. ## in the RewriteRule above.
  117. # Header always set Cache-Control "no-store, no-cache, must-revalidate" env=nocache
  118. ## Set Expires too ...
  119. # Header always set Expires "Thu, 01 Jan 1970 00:00:00 GMT" env=nocache
  120. # Rules to correctly serve gzip compressed CSS and JS files.
  121. # Requires both mod_rewrite and mod_headers to be enabled.
  122. <IfModule mod_headers.c>
  123. # Serve gzip compressed CSS files if they exist and the client accepts gzip.
  124. RewriteCond %{HTTP:Accept-encoding} gzip
  125. RewriteCond %{REQUEST_FILENAME}\.gz -s
  126. RewriteRule ^(.*)\.css $1\.css\.gz [QSA]
  127. # Serve gzip compressed JS files if they exist and the client accepts gzip.
  128. RewriteCond %{HTTP:Accept-encoding} gzip
  129. RewriteCond %{REQUEST_FILENAME}\.gz -s
  130. RewriteRule ^(.*)\.js $1\.js\.gz [QSA]
  131. # Serve correct content types, and prevent mod_deflate double gzip.
  132. RewriteRule \.css\.gz$ - [T=text/css,E=no-gzip:1]
  133. RewriteRule \.js\.gz$ - [T=text/javascript,E=no-gzip:1]
  134. <FilesMatch "(\.js\.gz|\.css\.gz)$">
  135. # Serve correct encoding type.
  136. Header set Content-Encoding gzip
  137. # Force proxies to cache gzipped & non-gzipped css/js files separately.
  138. Header append Vary Accept-Encoding
  139. </FilesMatch>
  140. </IfModule>
  141. </IfModule>
  142. # FROM Html5 BoilerPlate 4.0
  143. # ----------------------------------------------------------------------
  144. # Proper MIME type for all files
  145. # ----------------------------------------------------------------------
  146. # JavaScript
  147. # Normalize to standard type (it's sniffed in IE anyways)
  148. # tools.ietf.org/html/rfc4329#section-7.2
  149. AddType application/javascript js jsonp
  150. AddType application/json json
  151. # Audio
  152. AddType audio/ogg oga ogg
  153. AddType audio/mp4 m4a f4a f4b
  154. # Video
  155. AddType video/ogg ogv
  156. AddType video/mp4 mp4 m4v f4v f4p
  157. AddType video/webm webm
  158. AddType video/x-flv flv
  159. # SVG
  160. # Required for svg webfonts on iPad
  161. # twitter.com/FontSquirrel/status/14855840545
  162. AddType image/svg+xml svg svgz
  163. AddEncoding gzip svgz
  164. # Webfonts
  165. AddType application/vnd.ms-fontobject eot
  166. AddType application/x-font-ttf ttf ttc
  167. AddType font/opentype otf
  168. AddType application/x-font-woff woff
  169. # Assorted types
  170. AddType image/x-icon ico
  171. AddType image/webp webp
  172. AddType text/cache-manifest appcache manifest
  173. AddType text/x-component htc
  174. AddType application/xml rss atom xml rdf
  175. AddType application/x-chrome-extension crx
  176. AddType application/x-opera-extension oex
  177. AddType application/x-xpinstall xpi
  178. AddType application/octet-stream safariextz
  179. AddType application/x-web-app-manifest+json webapp
  180. AddType text/x-vcard vcf
  181. AddType application/x-shockwave-flash swf
  182. AddType text/vtt vtt
  183. # ----------------------------------------------------------------------
  184. # UTF-8 encoding
  185. # ----------------------------------------------------------------------
  186. # Use UTF-8 encoding for anything served text/plain or text/html
  187. AddDefaultCharset utf-8
  188. # Force UTF-8 for a number of file formats
  189. AddCharset utf-8 .atom .css .js .json .rss .vtt .xml
  190. # ----------------------------------------------------------------------
  191. # A little more security
  192. # ----------------------------------------------------------------------
  193. # Block access to "hidden" directories or files whose names begin with a
  194. # period. This includes directories used by version control systems such as
  195. # Subversion or Git.
  196. <IfModule mod_rewrite.c>
  197. RewriteCond %{SCRIPT_FILENAME} -d [OR]
  198. RewriteCond %{SCRIPT_FILENAME} -f
  199. RewriteRule "(^|/)\." - [F]
  200. </IfModule>
  201. # Block access to backup and source files. These files may be left by some
  202. # text/html editors and pose a great security danger, when anyone can access
  203. # them.
  204. <FilesMatch "(\.(bak|config|sql|fla|psd|ini|log|sh|inc|swp|dist)|~)$">
  205. Order allow,deny
  206. Deny from all
  207. Satisfy All
  208. </FilesMatch>
  209. # Increase cookie security
  210. <IfModule php5_module>
  211. php_value session.cookie_httponly true
  212. </IfModule>