.htaccess.sample 11 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402
  1. ############################################
  2. ## overrides deployment configuration mode value
  3. ## use command bin/magento deploy:mode:set to switch modes
  4. # SetEnv MAGE_MODE developer
  5. ############################################
  6. ## uncomment these lines for CGI mode
  7. ## make sure to specify the correct cgi php binary file name
  8. ## it might be /cgi-bin/php-cgi
  9. # Action php5-cgi /cgi-bin/php5-cgi
  10. # AddHandler php5-cgi .php
  11. ############################################
  12. ## GoDaddy specific options
  13. # Options -MultiViews
  14. ## you might also need to add this line to php.ini
  15. ## cgi.fix_pathinfo = 1
  16. ## if it still doesn't work, rename php.ini to php5.ini
  17. ############################################
  18. ## this line is specific for 1and1 hosting
  19. #AddType x-mapp-php5 .php
  20. #AddHandler x-mapp-php5 .php
  21. ############################################
  22. ## enable usage of methods arguments in backtrace
  23. SetEnv MAGE_DEBUG_SHOW_ARGS 1
  24. ############################################
  25. ## default index file
  26. DirectoryIndex index.php
  27. ############################################
  28. ## adjust memory limit
  29. php_value memory_limit 756M
  30. php_value max_execution_time 18000
  31. ############################################
  32. ## disable automatic session start
  33. ## before autoload was initialized
  34. php_flag session.auto_start off
  35. ############################################
  36. ## enable resulting html compression
  37. #php_flag zlib.output_compression on
  38. ###########################################
  39. ## disable user agent verification to not break multiple image upload
  40. php_flag suhosin.session.cryptua off
  41. <IfModule mod_security.c>
  42. ###########################################
  43. ## disable POST processing to not break multiple image upload
  44. SecFilterEngine Off
  45. SecFilterScanPOST Off
  46. </IfModule>
  47. <IfModule mod_deflate.c>
  48. ############################################
  49. ## enable apache served files compression
  50. ## http://developer.yahoo.com/performance/rules.html#gzip
  51. # Insert filter on all content
  52. ###SetOutputFilter DEFLATE
  53. # Insert filter on selected content types only
  54. #AddOutputFilterByType DEFLATE text/html text/plain text/xml text/css text/javascript application/javascript application/x-javascript application/json image/svg+xml
  55. # Netscape 4.x has some problems...
  56. #BrowserMatch ^Mozilla/4 gzip-only-text/html
  57. # Netscape 4.06-4.08 have some more problems
  58. #BrowserMatch ^Mozilla/4\.0[678] no-gzip
  59. # MSIE masquerades as Netscape, but it is fine
  60. #BrowserMatch \bMSIE !no-gzip !gzip-only-text/html
  61. # Don't compress images
  62. #SetEnvIfNoCase Request_URI \.(?:gif|jpe?g|png)$ no-gzip dont-vary
  63. # Make sure proxies don't deliver the wrong content
  64. #Header append Vary User-Agent env=!dont-vary
  65. </IfModule>
  66. <IfModule mod_ssl.c>
  67. ############################################
  68. ## make HTTPS env vars available for CGI mode
  69. SSLOptions StdEnvVars
  70. </IfModule>
  71. ############################################
  72. ## workaround for Apache 2.4.6 CentOS build when working via ProxyPassMatch with HHVM (or any other)
  73. ## Please, set it on virtual host configuration level
  74. ## SetEnvIf Authorization "(.*)" HTTP_AUTHORIZATION=$1
  75. ############################################
  76. <IfModule mod_rewrite.c>
  77. ############################################
  78. ## enable rewrites
  79. # The following line has better security but add some performance overhead - see https://httpd.apache.org/docs/2.4/en/misc/perf-tuning.html
  80. Options -FollowSymLinks +SymLinksIfOwnerMatch
  81. RewriteEngine on
  82. ############################################
  83. ## you can put here your magento root folder
  84. ## path relative to web root
  85. #RewriteBase /magento/
  86. ############################################
  87. ## workaround for HTTP authorization
  88. ## in CGI environment
  89. RewriteRule .* - [E=HTTP_AUTHORIZATION:%{HTTP:Authorization}]
  90. ############################################
  91. ## TRACE and TRACK HTTP methods disabled to prevent XSS attacks
  92. RewriteCond %{REQUEST_METHOD} ^TRAC[EK]
  93. RewriteRule .* - [L,R=405]
  94. ############################################
  95. ## redirect for mobile user agents
  96. #RewriteCond %{REQUEST_URI} !^/mobiledirectoryhere/.*$
  97. #RewriteCond %{HTTP_USER_AGENT} "android|blackberry|ipad|iphone|ipod|iemobile|opera mobile|palmos|webos|googlebot-mobile" [NC]
  98. #RewriteRule ^(.*)$ /mobiledirectoryhere/ [L,R=302]
  99. ############################################
  100. ## never rewrite for existing files, directories and links
  101. RewriteCond %{REQUEST_FILENAME} !-f
  102. RewriteCond %{REQUEST_FILENAME} !-d
  103. RewriteCond %{REQUEST_FILENAME} !-l
  104. ############################################
  105. ## rewrite everything else to index.php
  106. RewriteRule .* index.php [L]
  107. </IfModule>
  108. ############################################
  109. ## Prevent character encoding issues from server overrides
  110. ## If you still have problems, use the second line instead
  111. AddDefaultCharset Off
  112. #AddDefaultCharset UTF-8
  113. AddType 'text/html; charset=UTF-8' html
  114. <IfModule mod_expires.c>
  115. ############################################
  116. ## Add default Expires header
  117. ## http://developer.yahoo.com/performance/rules.html#expires
  118. ExpiresDefault "access plus 1 year"
  119. ExpiresByType text/html A0
  120. ExpiresByType text/plain A0
  121. </IfModule>
  122. ###########################################
  123. ## Deny access to root files to hide sensitive application information
  124. RedirectMatch 403 /\.git
  125. <Files composer.json>
  126. <IfVersion < 2.4>
  127. order allow,deny
  128. deny from all
  129. </IfVersion>
  130. <IfVersion >= 2.4>
  131. Require all denied
  132. </IfVersion>
  133. </Files>
  134. <Files composer.lock>
  135. <IfVersion < 2.4>
  136. order allow,deny
  137. deny from all
  138. </IfVersion>
  139. <IfVersion >= 2.4>
  140. Require all denied
  141. </IfVersion>
  142. </Files>
  143. <Files .gitignore>
  144. <IfVersion < 2.4>
  145. order allow,deny
  146. deny from all
  147. </IfVersion>
  148. <IfVersion >= 2.4>
  149. Require all denied
  150. </IfVersion>
  151. </Files>
  152. <Files .htaccess>
  153. <IfVersion < 2.4>
  154. order allow,deny
  155. deny from all
  156. </IfVersion>
  157. <IfVersion >= 2.4>
  158. Require all denied
  159. </IfVersion>
  160. </Files>
  161. <Files .htaccess.sample>
  162. <IfVersion < 2.4>
  163. order allow,deny
  164. deny from all
  165. </IfVersion>
  166. <IfVersion >= 2.4>
  167. Require all denied
  168. </IfVersion>
  169. </Files>
  170. <Files .php_cs.dist>
  171. <IfVersion < 2.4>
  172. order allow,deny
  173. deny from all
  174. </IfVersion>
  175. <IfVersion >= 2.4>
  176. Require all denied
  177. </IfVersion>
  178. </Files>
  179. <Files .travis.yml>
  180. <IfVersion < 2.4>
  181. order allow,deny
  182. deny from all
  183. </IfVersion>
  184. <IfVersion >= 2.4>
  185. Require all denied
  186. </IfVersion>
  187. </Files>
  188. <Files CHANGELOG.md>
  189. <IfVersion < 2.4>
  190. order allow,deny
  191. deny from all
  192. </IfVersion>
  193. <IfVersion >= 2.4>
  194. Require all denied
  195. </IfVersion>
  196. </Files>
  197. <Files COPYING.txt>
  198. <IfVersion < 2.4>
  199. order allow,deny
  200. deny from all
  201. </IfVersion>
  202. <IfVersion >= 2.4>
  203. Require all denied
  204. </IfVersion>
  205. </Files>
  206. <Files Gruntfile.js>
  207. <IfVersion < 2.4>
  208. order allow,deny
  209. deny from all
  210. </IfVersion>
  211. <IfVersion >= 2.4>
  212. Require all denied
  213. </IfVersion>
  214. </Files>
  215. <Files LICENSE.txt>
  216. <IfVersion < 2.4>
  217. order allow,deny
  218. deny from all
  219. </IfVersion>
  220. <IfVersion >= 2.4>
  221. Require all denied
  222. </IfVersion>
  223. </Files>
  224. <Files LICENSE_AFL.txt>
  225. <IfVersion < 2.4>
  226. order allow,deny
  227. deny from all
  228. </IfVersion>
  229. <IfVersion >= 2.4>
  230. Require all denied
  231. </IfVersion>
  232. </Files>
  233. <Files nginx.conf.sample>
  234. <IfVersion < 2.4>
  235. order allow,deny
  236. deny from all
  237. </IfVersion>
  238. <IfVersion >= 2.4>
  239. Require all denied
  240. </IfVersion>
  241. </Files>
  242. <Files package.json>
  243. <IfVersion < 2.4>
  244. order allow,deny
  245. deny from all
  246. </IfVersion>
  247. <IfVersion >= 2.4>
  248. Require all denied
  249. </IfVersion>
  250. </Files>
  251. <Files php.ini.sample>
  252. <IfVersion < 2.4>
  253. order allow,deny
  254. deny from all
  255. </IfVersion>
  256. <IfVersion >= 2.4>
  257. Require all denied
  258. </IfVersion>
  259. </Files>
  260. <Files README.md>
  261. <IfVersion < 2.4>
  262. order allow,deny
  263. deny from all
  264. </IfVersion>
  265. <IfVersion >= 2.4>
  266. Require all denied
  267. </IfVersion>
  268. </Files>
  269. <Files magento_umask>
  270. <IfVersion < 2.4>
  271. order allow,deny
  272. deny from all
  273. </IfVersion>
  274. <IfVersion >= 2.4>
  275. Require all denied
  276. </IfVersion>
  277. </Files>
  278. <Files auth.json>
  279. <IfVersion < 2.4>
  280. order allow,deny
  281. deny from all
  282. </IfVersion>
  283. <IfVersion >= 2.4>
  284. Require all denied
  285. </IfVersion>
  286. </Files>
  287. <Files .user.ini>
  288. <IfVersion < 2.4>
  289. order allow,deny
  290. deny from all
  291. </IfVersion>
  292. <IfVersion >= 2.4>
  293. Require all denied
  294. </IfVersion>
  295. </Files>
  296. # For 404s and 403s that aren't handled by the application, show plain 404 response
  297. ErrorDocument 404 /pub/errors/404.php
  298. ErrorDocument 403 /pub/errors/404.php
  299. ################################
  300. ## If running in cluster environment, uncomment this
  301. ## http://developer.yahoo.com/performance/rules.html#etags
  302. #FileETag none
  303. # ######################################################################
  304. # # INTERNET EXPLORER #
  305. # ######################################################################
  306. # ----------------------------------------------------------------------
  307. # | Document modes |
  308. # ----------------------------------------------------------------------
  309. # Force Internet Explorer 8/9/10 to render pages in the highest mode
  310. # available in the various cases when it may not.
  311. #
  312. # https://hsivonen.fi/doctype/#ie8
  313. #
  314. # (!) Starting with Internet Explorer 11, document modes are deprecated.
  315. # If your business still relies on older web apps and services that were
  316. # designed for older versions of Internet Explorer, you might want to
  317. # consider enabling `Enterprise Mode` throughout your company.
  318. #
  319. # https://msdn.microsoft.com/en-us/library/ie/bg182625.aspx#docmode
  320. # http://blogs.msdn.com/b/ie/archive/2014/04/02/stay-up-to-date-with-enterprise-mode-for-internet-explorer-11.aspx
  321. <IfModule mod_headers.c>
  322. Header set X-UA-Compatible "IE=edge"
  323. # `mod_headers` cannot match based on the content-type, however,
  324. # the `X-UA-Compatible` response header should be send only for
  325. # HTML documents and not for the other resources.
  326. <FilesMatch "\.(appcache|atom|bbaw|bmp|crx|css|cur|eot|f4[abpv]|flv|geojson|gif|htc|ico|jpe?g|js|json(ld)?|m4[av]|manifest|map|mp4|oex|og[agv]|opus|otf|pdf|png|rdf|rss|safariextz|svgz?|swf|topojson|tt[cf]|txt|vcard|vcf|vtt|webapp|web[mp]|webmanifest|woff2?|xloc|xml|xpi)$">
  327. Header unset X-UA-Compatible
  328. </FilesMatch>
  329. </IfModule>