.htaccess 6.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172
  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. # SSL
  48. # RewriteCond %{HTTPS} off [OR]
  49. # RewriteCond %{HTTP_HOST} ^materio\.com*
  50. # RewriteRule ^(.*)$ https://www.materio.com/$1 [L,R=301]
  51. # Redirect to HTTPS
  52. # RewriteCond %{HTTPS} off
  53. # RewriteCond %{HTTP:X-Forwarded-Proto} !https
  54. # RewriteRule ^(.*)$ https://%{HTTP_HOST}%{REQUEST_URI} [L,R=301]
  55. # CUSTOMS
  56. # redirect all materiau domains to materio.com
  57. RewriteCond %{HTTPS} off
  58. RewriteCond %{HTTP_HOST} ^basebeta\.materio\.com [OR]
  59. RewriteCond %{HTTP_HOST} ^materio\.com [OR]
  60. RewriteCond %{HTTP_HOST} ^www\.materio\.fr [OR]
  61. RewriteCond %{HTTP_HOST} ^materio\.fr [OR]
  62. RewriteCond %{HTTP_HOST} ^www\.materio\.net [OR]
  63. RewriteCond %{HTTP_HOST} ^materio\.net [OR]
  64. RewriteCond %{HTTP_HOST} ^www\.materio\.eu [OR]
  65. RewriteCond %{HTTP_HOST} ^materio\.eu
  66. RewriteRule ^ http://www.materio.com%{REQUEST_URI} [L,R=301]
  67. # Set "protossl" to "s" if we were accessed via https://. This is used later
  68. # if you enable "www." stripping or enforcement, in order to ensure that
  69. # you don't bounce between http and https.
  70. RewriteRule ^ - [E=protossl]
  71. RewriteCond %{HTTPS} on
  72. RewriteRule ^ - [E=protossl:s]
  73. # Make sure Authorization HTTP header is available to PHP
  74. # even when running as CGI or FastCGI.
  75. RewriteRule ^ - [E=HTTP_AUTHORIZATION:%{HTTP:Authorization}]
  76. # Block access to "hidden" directories whose names begin with a period. This
  77. # includes directories used by version control systems such as Subversion or
  78. # Git to store control files. Files whose names begin with a period, as well
  79. # as the control files used by CVS, are protected by the FilesMatch directive
  80. # above.
  81. #
  82. # NOTE: This only works when mod_rewrite is loaded. Without mod_rewrite, it is
  83. # not possible to block access to entire directories from .htaccess, because
  84. # <DirectoryMatch> is not allowed here.
  85. #
  86. # If you do not have mod_rewrite installed, you should remove these
  87. # directories from your webroot or otherwise protect them from being
  88. # downloaded.
  89. RewriteRule "(^|/)\." - [F]
  90. # If your site can be accessed both with and without the 'www.' prefix, you
  91. # can use one of the following settings to redirect users to your preferred
  92. # URL, either WITH or WITHOUT the 'www.' prefix. Choose ONLY one option:
  93. #
  94. # To redirect all users to access the site WITH the 'www.' prefix,
  95. # (http://example.com/... will be redirected to http://www.example.com/...)
  96. # uncomment the following:
  97. RewriteCond %{HTTP_HOST} .
  98. RewriteCond %{HTTP_HOST} !^www\. [NC]
  99. RewriteRule ^ http%{ENV:protossl}://www.%{HTTP_HOST}%{REQUEST_URI} [L,R=301]
  100. # To redirect all users to access the site WITHOUT the 'www.' prefix,
  101. # (http://www.example.com/... will be redirected to http://example.com/...)
  102. # uncomment the following:
  103. # RewriteCond %{HTTP_HOST} ^www\.(.+)$ [NC]
  104. # RewriteRule ^ http%{ENV:protossl}://%1%{REQUEST_URI} [L,R=301]
  105. # Modify the RewriteBase if you are using Drupal in a subdirectory or in a
  106. # VirtualDocumentRoot and the rewrite rules are not working properly.
  107. # For example if your site is at http://example.com/drupal uncomment and
  108. # modify the following line:
  109. # RewriteBase /drupal
  110. #
  111. # If your site is running in a VirtualDocumentRoot at http://example.com/,
  112. # uncomment the following line:
  113. RewriteBase /
  114. # Pass all requests not referring directly to files in the filesystem to
  115. # index.php. Clean URLs are handled in drupal_environment_initialize().
  116. RewriteCond %{REQUEST_FILENAME} !-f
  117. RewriteCond %{REQUEST_FILENAME} !-d
  118. RewriteCond %{REQUEST_URI} !=/favicon.ico
  119. RewriteRule ^ index.php [L]
  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. # Add headers to all responses.
  143. <IfModule mod_headers.c>
  144. # Disable content sniffing, since it's an attack vector.
  145. Header always set X-Content-Type-Options nosniff
  146. </IfModule>