Advertisement
Guest User

Untitled

a guest
Apr 15th, 2018
154
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 10.31 KB | None | 0 0
  1. ##
  2. # This file is part of Contao.
  3. #
  4. # (c) Leo Feyer
  5. #
  6. # @license LGPL-3.0-or-later
  7. ##
  8.  
  9. ##
  10. # Prevent access to the Contao template files
  11. ##
  12. <FilesMatch "\.(tpl|html5|xhtml)$">
  13. <IfModule !mod_authz_core.c>
  14. Order deny,allow
  15. Deny from all
  16. </IfModule>
  17. <IfModule mod_authz_core.c>
  18. Require all denied
  19. </IfModule>
  20. </FilesMatch>
  21.  
  22. ##
  23. # Allow access from all domains for webfonts
  24. # @see https://github.com/h5bp/html5-boilerplate
  25. ##
  26. <IfModule mod_headers.c>
  27. <FilesMatch "\.(ttf|ttc|otf|eot|woff2?|font\.css)$">
  28. Header set Access-Control-Allow-Origin "*"
  29. </FilesMatch>
  30. </IfModule>
  31.  
  32. ##
  33. # Disable ETags
  34. # @see http://developer.yahoo.com/performance/rules.html#etags
  35. ##
  36. FileETag None
  37. <IfModule mod_headers.c>
  38. Header unset ETag
  39. </IfModule>
  40.  
  41. ##
  42. # Set the proper MIME types
  43. # @see https://github.com/h5bp/html5-boilerplate
  44. ##
  45. <IfModule mod_mime.c>
  46. AddType application/javascript js jsonp
  47. AddType application/json json
  48. AddType audio/ogg oga ogg
  49. AddType audio/mp4 m4a f4a f4b
  50. AddType video/ogg ogv
  51. AddType video/mp4 mp4 m4v f4v f4p
  52. AddType video/webm webm
  53. AddType video/x-flv flv
  54. AddType image/svg+xml svg svgz
  55. AddEncoding gzip svgz
  56. AddType application/vnd.ms-fontobject eot
  57. AddType application/x-font-ttf ttf ttc
  58. AddType font/opentype otf
  59. AddType application/x-font-woff woff woff2
  60. AddType image/x-icon ico
  61. AddType image/webp webp
  62. AddType text/cache-manifest appcache manifest
  63. AddType text/x-component htc
  64. AddType application/xml rss atom xml rdf
  65. AddType application/x-web-app-manifest+json webapp
  66. AddType text/x-vcard vcf
  67. AddType application/x-shockwave-flash swf
  68. </IfModule>
  69.  
  70. ##
  71. # Gzip compression
  72. # @see https://github.com/h5bp/html5-boilerplate
  73. ##
  74. <IfModule mod_deflate.c>
  75. <IfModule mod_filter.c>
  76. AddOutputFilterByType DEFLATE text/html text/plain text/css application/json
  77. AddOutputFilterByType DEFLATE application/javascript
  78. AddOutputFilterByType DEFLATE text/xml application/xml text/x-component
  79. AddOutputFilterByType DEFLATE application/xhtml+xml application/rss+xml application/atom+xml
  80. AddOutputFilterByType DEFLATE image/x-icon image/svg+xml application/vnd.ms-fontobject application/x-font-ttf font/opentype
  81. </IfModule>
  82. </IfModule>
  83.  
  84. ##
  85. # Expires headers (for better cache control)
  86. # @see https://github.com/h5bp/html5-boilerplate
  87. ##
  88. <IfModule mod_expires.c>
  89. ExpiresActive on
  90.  
  91. ##
  92. # Productional website
  93. ##
  94. ExpiresByType text/cache-manifest "access plus 0 seconds"
  95. ExpiresByType text/html "access plus 0 seconds"
  96. ExpiresByType text/xml "access plus 0 seconds"
  97. ExpiresByType application/xml "access plus 0 seconds"
  98. ExpiresByType application/json "access plus 0 seconds"
  99. ExpiresByType application/rss+xml "access plus 1 hour"
  100. ExpiresByType application/atom+xml "access plus 1 hour"
  101. ExpiresByType image/gif "access plus 1 month"
  102. ExpiresByType image/png "access plus 1 month"
  103. ExpiresByType image/jpeg "access plus 1 month"
  104. ExpiresByType image/x-icon "access plus 1 month"
  105. ExpiresByType video/ogg "access plus 1 month"
  106. ExpiresByType audio/ogg "access plus 1 month"
  107. ExpiresByType video/mp4 "access plus 1 month"
  108. ExpiresByType video/webm "access plus 1 month"
  109. ExpiresByType text/x-component "access plus 1 month"
  110. ExpiresByType application/x-font-ttf "access plus 1 month"
  111. ExpiresByType font/opentype "access plus 1 month"
  112. ExpiresByType application/x-font-woff "access plus 1 month"
  113. ExpiresByType image/svg+xml "access plus 1 month"
  114. ExpiresByType application/vnd.ms-fontobject "access plus 1 month"
  115. ExpiresByType text/css "access plus 1 year"
  116. ExpiresByType application/javascript "access plus 1 year"
  117.  
  118. ##
  119. # Disable caching during development
  120. # @see https://github.com/contao/core/issues/4364
  121. ##
  122. #ExpiresByType text/cache-manifest "access"
  123. #ExpiresByType text/html "access"
  124. #ExpiresByType text/xml "access"
  125. #ExpiresByType application/xml "access"
  126. #ExpiresByType application/json "access"
  127. #ExpiresByType application/rss+xml "access"
  128. #ExpiresByType application/atom+xml "access"
  129. #ExpiresByType image/gif "access"
  130. #ExpiresByType image/png "access"
  131. #ExpiresByType image/jpeg "access"
  132. #ExpiresByType image/x-icon "access"
  133. #ExpiresByType video/ogg "access"
  134. #ExpiresByType audio/ogg "access"
  135. #ExpiresByType video/mp4 "access"
  136. #ExpiresByType video/webm "access"
  137. #ExpiresByType text/x-component "access"
  138. #ExpiresByType application/x-font-ttf "access"
  139. #ExpiresByType font/opentype "access"
  140. #ExpiresByType application/x-font-woff "access"
  141. #ExpiresByType image/svg+xml "access"
  142. #ExpiresByType application/vnd.ms-fontobject "access"
  143. #ExpiresByType text/css "access"
  144. #ExpiresByType application/javascript "access"
  145.  
  146. </IfModule>
  147.  
  148. ##
  149. # Header adjustments
  150. ##
  151. <IfModule mod_headers.c>
  152.  
  153. ##
  154. # Disable caching during development
  155. # @see https://github.com/contao/core/issues/4364
  156. ##
  157. #Header unset Cache-Control
  158. #Header append Cache-Control must-revalidate
  159.  
  160. ##
  161. # Do not cache the cron.txt file
  162. # @see https://github.com/contao/core/issues/5105
  163. ##
  164. <FilesMatch "cron\.txt$">
  165. Header set Cache-Control "no-cache, no-store, must-revalidate, max-age=0, proxy-revalidate, no-transform"
  166. </FilesMatch>
  167.  
  168. ##
  169. # Add a Vary Accept-Encoding header for the compressed resources. If you
  170. # modify the file types above, make sure to change them here accordingly.
  171. # @see http://developer.yahoo.com/performance/rules.html#gzip
  172. #
  173. # Note: If you are using a case-sensitive file system like HFS+ or ext4, you
  174. # have to change the <FilesMatch> directive as follows:
  175. #
  176. # <FilesMatch "\.(?i:js|css|xml|gz|svgz)$">
  177. #
  178. # For more information see: https://github.com/contao/core/issues/4364
  179. ##
  180. <FilesMatch "\.(js|css|xml|gz|svgz)$">
  181. Header append Vary Accept-Encoding
  182. </FilesMatch>
  183.  
  184. ##
  185. # Do not cache source map files
  186. # @see https://github.com/contao/core/issues/8532
  187. ##
  188. <FilesMatch "\.map$">
  189. Header set Expires "0"
  190. Header set Cache-Control "no-cache, no-store, must-revalidate, max-age=0, proxy-revalidate, no-transform"
  191. </FilesMatch>
  192.  
  193. </IfModule>
  194.  
  195. ##
  196. # Disable MultiViews if you are having issues with requests returning the wrong
  197. # page. Requires AllowOverride Options=All,MultiViews to be set here.
  198. # @see https://github.com/contao/core/issues/3521
  199. ##
  200. #Options -MultiViews
  201.  
  202. ##
  203. # URL rewriting
  204. ##
  205. <IfModule mod_rewrite.c>
  206. RewriteEngine On
  207.  
  208. ##
  209. # Change the RewriteBase if your Contao installation is in a subdirectoy and
  210. # the rewrite rules are not working properly. Usage examples:
  211. #
  212. # RewriteBase /contao-3.0.0
  213. # RewriteBase /path/to/contao
  214. #
  215. # Depending on your server, you might have to remove the line entirely.
  216. ##
  217. RewriteBase /
  218.  
  219. ##
  220. # Uncomment the following lines to add "www." to the domain:
  221. #
  222. # RewriteCond %{HTTP_HOST} ^example\.com$ [NC]
  223. # RewriteRule (.*) http://www.example.com/$1 [R=301,L]
  224. #
  225. # Uncomment the following lines to remove "www." from the domain:
  226. #
  227. # RewriteCond %{HTTP_HOST} ^www\.example\.com$ [NC]
  228. # RewriteRule (.*) http://example.com/$1 [R=301,L]
  229. #
  230. # Make sure to replace "example.com" with your domain name.
  231. ##
  232.  
  233. ##
  234. # If you cannot use mod_deflate, uncomment the following lines to load a
  235. # compressed .gz version of the aggregated Contao JavaScript and CSS files.
  236. ##
  237. #AddEncoding gzip .gz
  238. #<FilesMatch "\.js\.gz$">
  239. # AddType "application/javascript" .gz
  240. #</FilesMatch>
  241. #<FilesMatch "\.css\.gz$">
  242. # AddType "text/css" .gz
  243. #</FilesMatch>
  244. #RewriteCond %{HTTP:Accept-encoding} gzip
  245. #RewriteCond %{REQUEST_FILENAME} \.(js|css)$
  246. #RewriteCond %{REQUEST_FILENAME}.gz -f
  247. #RewriteRule ^(.*)$ $1.gz [QSA,L]
  248.  
  249. ##
  250. # By default, Contao adds ".html" to the generated URLs to simulate static
  251. # HTML documents. If you change the URL suffix in the back end settings, make
  252. # sure to change it here accordingly!
  253. #
  254. # RewriteRule .*\.html$ index.php [L] # URL suffix .html
  255. # RewriteRule .*\.txt$ index.php [L] # URL suffix .txt
  256. # RewriteRule .*\.json$ index.php [L] # URL suffix .json
  257. #
  258. # If you do not want to use an URL suffix at all, you have to add a third
  259. # line to prevent URLs that point to folders from being rewritten (see #4031).
  260. #
  261. # RewriteCond %{REQUEST_FILENAME} !-d
  262. # RewriteRule .* index.php [L]
  263. #
  264. # If you are using mod_cache, it is recommended to use the RewriteRule below,
  265. # which adds the query string to the internal URL:
  266. #
  267. # RewriteRule (.*\.html)$ index.php/$1 [L]
  268. #
  269. # Note that not all environments support mod_rewrite and mod_cache.
  270. ##
  271. RewriteCond %{REQUEST_FILENAME} !\.(htm|php|js|css|map|htc|png|gif|jpe?g|ico|xml|csv|txt|swf|flv|mp4|webm|ogv|mp3|ogg|oga|eot|otf|tt[cf]|woff2?|svgz?|pdf|zip|gz)$
  272. RewriteCond %{REQUEST_FILENAME} !-f
  273. RewriteCond %{REQUEST_FILENAME} !-d
  274. RewriteRule .* index.php [L]
  275.  
  276. ##
  277. # The following rules are required if you want to pass the language as first
  278. # URL parameter (added in Contao 2.11). The first rule rewrites the empty URL
  279. # to the front end controller, the second one adds a missing trailing slash.
  280. ##
  281. RewriteRule ^[a-z]{2}(\-[A-Z]{2})?/$ index.php [L]
  282. RewriteRule ^([a-z]{2}(\-[A-Z]{2})?)$ $1/ [R=301,L]
  283.  
  284. </IfModule>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement