Review main Merged

39254[TASK] Improve .htaccess files

Andreas Kienast CR +2 V +2 Hard +442 −103 updated 06/01/17, 12:23

Commit message

Improve the example .htaccess file by adding rules for caching,
MIME types and CORS. Also, the rewrite rules are extended to block
access to certain files and folders.

Additionally all rules are made compatible for Apache 2.4 as well.

Review

  • Code review CR +2
    • Markus Klein +2
    • Stephan Großberndt +1
  • Verified V +2
    • Markus Klein +2
    • Stephan Großberndt +1

Issues 2

Files 15

Review log 71

Show 46 earlier messages
  1. Andreas Kienast uploaded patch set 1 05/04/15, 09:16

  2. Andreas Kienast uploaded patch set 2 05/04/15, 09:16

  3. Stephan Großberndt voted on patch set 2 CR +1 05/04/15, 09:18

  4. Markus Klein commented on patch set 2 05/04/15, 09:33

    _.htaccess:115

    why limiting this to extensions?
  5. Andreas Kienast commented on patch set 2 05/04/15, 09:38

    _.htaccess:115 Reply

    Maybe there's the case one links to a SQL file for downloading, which is placed somewhere in fileadmin.
  6. Andreas Kienast uploaded patch set 3 05/04/15, 11:26

  7. Andreas Kienast uploaded patch set 4 05/04/15, 11:32

  8. Stephan Großberndt voted on patch set 4 CR +1 05/04/15, 11:33

  9. Stephan Großberndt voted on patch set 4 CR -1 05/04/15, 11:36

  10. Stephan Großberndt commented on patch set 4 05/04/15, 11:37

    _.htaccess:110

    Add rule here too.
  11. Markus Klein commented on patch set 4 CR -1 05/04/15, 11:38

    _.htaccess:114

    these need to be extended for typo3/contrib as well

    _.htaccess:115

    /* is wrong. you mean: /.+\.sql$

    _.htaccess:115

    non-capturing group here: (?:conf)
  12. Andreas Kienast commented on patch set 4 CR -2 05/04/15, 12:13

    .htaccess gets more improvements, I'm blocking this patch for the time being
  13. Andreas Kienast uploaded patch set 5 05/04/15, 13:55

  14. Andreas Kienast commented on patch set 5 CR 0 05/04/15, 13:55

    Released lock as it is WIP now
  15. Markus Klein commented on patch set 5 CR -2 05/04/15, 13:58

    Misses a lot from the https://notes.typo3.org/p/.htaccess_improvments document. Will work in that tonight.

    _.htaccess:113

    [*/] is wrong, must be [^/]

    _.htaccess:114

    if you use more groups then at least non-capturing ones. I prefer a simple list of paths inside 1 groups with alternation
  16. Frank Nägler commented on patch set 5 05/04/15, 14:01

    Please add a rst file for this change, because the .htaccess file is mostly not part of an update.
  17. Frank Nägler commented on patch set 5 05/04/15, 14:13

    please also a hint in the release notes! in 6.2
  18. Stephan Großberndt commented on patch set 5 CR -1 05/04/15, 14:13

    _.htaccess:114

    Why block Configuration and Resources/Private in /typo3/contrib? These are no common directories there. Why /[*/]+ in Configuration and [^/]+ in Resources? ^(?:typo3conf/ext|typo3/(?:sysext|ext))/[^/]+/Configuration/ ^(?:typo3conf/ext|typo3/(?:sysext|ext))/[^/]+/Resources/Private/

    _.htaccess:118

    ^(?:ChangeLog|ToDo|Readme|License)\.(?:md|txt)? allows ChangeLog but prevents access to ChangeLog. ^(?:ChangeLog|ToDo|Readme|License)\.?(?:md|txt)? Does ext_(.*)\.txt need the braces? => ext_.*\.txt Same for locallang(.*)\.(xml|xlf) => locallang.*\.(?:xml|xlf) bak|conf => bak|co?nf|cfg sql(.*) => sql(?:.*)
  19. Stephan Großberndt uploaded patch set 6 05/04/15, 14:27

  20. Stephan Großberndt commented on patch set 6 CR -1 05/04/15, 14:32

    Still needs RST, mention in 6.2 release notes, more from https://notes.typo3.org/p/.htaccess_improvments I just wanted to fix the issues I spotted.
  21. Morton Jonuschat commented on patch set 6 05/04/15, 17:05

    _.htaccess:111

    Isn't this line missing a \. after TYPO3root/ ?
  22. Markus Klein uploaded patch set 7 05/04/15, 23:48

  23. Markus Klein commented on patch set 7 CR 0 05/04/15, 23:49

    Yet untested.
  24. Markus Klein uploaded patch set 8 05/04/15, 23:50

  25. Markus Klein uploaded patch set 9 05/04/15, 23:52

  26. Andreas Kienast commented on patch set 9 05/05/15, 07:13

    _.htaccess:305

    Sidenote: Shouldn't we also extend the default setting of "[EXT][excludeForPackaging]" by some of these values?
  27. Markus Klein commented on patch set 9 05/05/15, 08:25

    Indeed, we should.
  28. Stephan Großberndt voted on patch set 9 CR +1 05/06/15, 08:04

  29. Stephan Großberndt voted on patch set 9 CR 0 05/06/15, 08:04

  30. Andreas Kienast updated the commit message in patch set 10 05/06/15, 08:28

  31. Markus Klein commented on patch set 10 05/06/15, 08:35

    I'll give this file a testing shot on a live-server soonish
  32. Stephan Großberndt voted on patch set 10 CR +1 05/06/15, 08:36

  33. Stephan Großberndt commented on patch set 10 CR -1 05/06/15, 09:01

    _.htaccess:284

    Why protect typo3/vendor/*/Configuration and typo3/vendor/*/Resources/Private? Those subdirectories are no common structure there and do not exist.
  34. Stephan Großberndt commented on patch set 10 05/06/15, 09:09

    Tested this config: Put it in a separate file and included it from vhost.httpd. Fails because of "RewriteBase: only valid in per-directory config files " commented "RewriteBase /". Now I get 400-error "Your browser sent a request that this server could not understand." :-| Apache/2.2.22 (Debian)
  35. Markus Klein commented on patch set 10 CR -1 05/06/15, 09:29

    This is still a draft. will add the [wip]

    _.htaccess:284 Reply

    because if you add exts via composer they reside there.
  36. Markus Klein updated the commit message in patch set 11 05/06/15, 09:29

  37. Stephan Großberndt commented on patch set 10 05/06/15, 10:07

    Ok, I just need to wrap the <IfModule mod_rewrite.c /> in <Directory /> </Directory> since I do include the configuration via Include from my vhost.httpd. Looks good so far!

    _.htaccess:284 Reply

    Ah, ok, didn't use that so far. Then its fine. What about typo3conf\ext\*\static
  38. Stephan Großberndt voted on patch set 11 CR +1 05/06/15, 10:08

  39. Stephan Großberndt commented on patch set 11 05/12/15, 10:22

    _.htaccess:349

    This currently fails on IE, because ThumbnailView.php serves header('Content-type: image/'.$outext); resulting in Content-type: image/jpg instead of Content-type: image/jpeg. I'll create a bug report for it. That bug should be fixed before merging this.
  40. Stephan Großberndt voted on patch set 11 V -1 05/12/15, 10:22

  41. Stephan Großberndt voted on patch set 11 CR 0 05/12/15, 10:22

  42. Stephan Großberndt commented on patch set 11 CR -1 05/12/15, 10:22

    _.htaccess:334

    Put all those mod_headers.c conditions into one?
  43. Markus Klein commented on patch set 11 05/12/15, 10:51

    _.htaccess:334 Reply

    Thought about that already, but I kept it separated due to different concern. This here is IE only.

    _.htaccess:349 Reply

    Alright, thanks.
  44. Stephan Großberndt commented on patch set 11 05/12/15, 10:53

  45. Wouter Wolters commented on patch set 11 05/12/15, 21:41

  46. Stephan Großberndt updated the commit message in patch set 12 05/12/15, 22:18

  1. Markus Klein uploaded patch set 13 05/13/15, 12:36

  2. Markus Klein uploaded patch set 14 05/13/15, 12:38

  3. Markus Klein updated the commit message in patch set 15 05/13/15, 12:40

  4. Stephan Großberndt commented on patch set 15 05/13/15, 13:43

    _.htaccess:362

    This could be removed on master
  5. Xavier Perseguers commented on patch set 15 05/13/15, 14:10

    Could we think about documenting somewhere (I think of the sample _.htaccess for Apache) how to configure Nginx in a similar manner? I mean Apache and Nginx are both widely used, we cannot automatically configure Nginx with htaccess but we could anyway document how to do it. Restricting access to Private directories is easily done but the whole speed enhancement + CORS would be much appreciated to Nginx admins.
  6. Markus Klein commented on patch set 15 05/13/15, 16:10

    Would do the nginx docs separately. Mattes offered help here. Once we have this patch as a basis, we can easily deduce the according nginx rules. (which should also go into docs, I'd say)
  7. Stephan Großberndt uploaded patch set 16 06/30/15, 09:24

  8. Stephan Großberndt commented on patch set 16 CR +1 V +1 06/30/15, 09:34

    I use this setup for nearly two months now and it works fine. Are there any TODOs left why this should not be merged yet? I don't see any.
  9. Markus Klein commented on patch set 16 06/30/15, 10:25

    _.htaccess:339

    trailing space
  10. Stephan Großberndt uploaded patch set 17 06/30/15, 10:27

  11. Markus Klein voted on patch set 17 CR +1 V +1 06/30/15, 10:28

  12. Stephan Großberndt voted on patch set 17 CR +1 V +1 06/30/15, 10:31

  13. Mathias Brodala commented on patch set 17 06/30/15, 10:33

    _.htaccess:260

    What's the purpose for this? (Aside from "it's used afterwards." ;-) )
  14. Mathias Brodala uploaded patch set 18 06/30/15, 10:52

  15. Stephan Großberndt voted on patch set 18 CR +1 V +1 06/30/15, 11:04

  16. Andreas Kienast commented on patch set 18 07/01/15, 08:59

    _.htaccess:304

    Should we add "composer.json" here, too?
  17. Stephan Großberndt commented on patch set 18 CR 0 07/01/15, 10:15

    _.htaccess:304 Reply

    I think, thats a good idea. Markus?
  18. Stephan Großberndt uploaded patch set 19 07/01/15, 10:32

  19. Stephan Großberndt commented on patch set 19 CR +1 V +1 07/01/15, 10:36

    added composer.(json|lock)
  20. Markus Klein commented on patch set 19 CR +2 V +2 07/01/15, 10:38

    Lets put that into master now.
  21. Markus Klein merged patch set 19 07/01/15, 10:38

  22. Markus Klein commented on patch set 20 07/06/15, 12:27

    _.htaccess:258

    This line causes troubles for me, when running in a subdirectory. Commenting it out, makes things working
  23. Markus Klein commented on patch set 20 07/06/15, 12:37

    _.htaccess:258 Reply

  24. Patrik Karisch commented on patch set 20 06/01/17, 12:00

    _.htaccess:348

    Why do you remove the ETag?
  25. Wouter Wolters commented on patch set 20 06/01/17, 12:23