A fork of the NoNonsenseForum, we use as bugtracker http://camendesign.com/nononsense_forum https://github.com/Kroc/NoNonsenseForum
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

179 lines
6.9KB

  1. # NoNonsense Forum v26 © Copyright (CC-BY) Kroc Camen 2010-2015
  2. # licenced under Creative Commons Attribution 3.0 <creativecommons.org/licenses/by/3.0/deed.en_GB>
  3. # you may do whatever you want to this code as long as you give credit to Kroc Camen, <camendesign.com>
  4. # some features of this file taken from HTML5 boilerplate <h5bp.com>,
  5. # which took features from my website <camendesign.com> :)
  6. ServerSignature Off
  7. AddDefaultCharset utf-8
  8. # this ‘feature’ (MultiViews) drove me absolutely insane!
  9. # without this, Apache will give a 404 for a rewrite if a folder of the same name does not exist (e.g. “/blog/hello”)
  10. # <webmasterworld.com/apache/3808792.htm>
  11. Options -MultiViews -Indexes +SymLinksIfOwnerMatch
  12. <IfModule mod_dir.c>
  13. DirectoryIndex index.php
  14. </IfModule>
  15. # mime types:
  16. # --------------------------------------------------------------------------------------------------------------------------
  17. # NNF doesn't use all of these by default, but custom themes might,
  18. # which will save admins having to modify this file
  19. <IfModule mod_mime.c>
  20. # JavaScript
  21. # normalize to standard type (it's sniffed in IE anyways)
  22. # <tools.ietf.org/html/rfc4329#section-7.2>
  23. AddType application/javascript js
  24. # XML / RSS
  25. AddType application/xml xml
  26. AddType application/rss+xml rss
  27. # SVG
  28. # required for svg webfonts on iPad
  29. # <twitter.com/FontSquirrel/status/14855840545>
  30. AddType image/svg+xml svg svgz
  31. AddEncoding gzip svgz
  32. # webfonts
  33. AddType application/vnd.ms-fontobject eot
  34. AddType application/x-font-ttf ttf ttc
  35. AddType font/opentype otf
  36. AddType application/x-font-woff woff
  37. # Assorted types
  38. AddType image/x-icon ico
  39. AddType image/webp webp
  40. AddType application/x-shockwave-flash swf
  41. AddCharset utf-8 .css .js .rss .xml
  42. </IfModule>
  43. <Files "index.xml">
  44. # 'index.xml' (unlike 'sitemap.xml') is an RSS feed
  45. ForceType application/rss+xml
  46. </Files>
  47. # compression:
  48. # --------------------------------------------------------------------------------------------------------------------------
  49. <IfModule mod_deflate.c>
  50. # Force compression for mangled headers.
  51. # http://developer.yahoo.com/blogs/ydn/posts/2010/12/pushing-beyond-gzipping
  52. <IfModule mod_setenvif.c>
  53. <IfModule mod_headers.c>
  54. SetEnvIfNoCase ^(Accept-EncodXng|X-cept-Encoding|X{15}|~{15}|-{15})$ ^((gzip|deflate)\s*,?\s*)+|[X~-]{4,13}$ HAVE_Accept-Encoding
  55. RequestHeader append Accept-Encoding "gzip,deflate" env=HAVE_Accept-Encoding
  56. </IfModule>
  57. </IfModule>
  58. # Compress all output labeled with one of the following MIME-types
  59. # (for Apache versions below 2.3.7, you don't need to enable `mod_filter`
  60. # and can remove the `<IfModule mod_filter.c>` and `</IfModule>` lines
  61. # as `AddOutputFilterByType` is still in the core directives).
  62. <IfModule mod_filter.c>
  63. AddOutputFilterByType DEFLATE application/atom+xml \
  64. application/javascript \
  65. application/json \
  66. application/rss+xml \
  67. application/vnd.ms-fontobject \
  68. application/x-font-ttf \
  69. application/x-web-app-manifest+json \
  70. application/xhtml+xml \
  71. application/xml \
  72. font/opentype \
  73. image/svg+xml \
  74. image/x-icon \
  75. text/css \
  76. text/html \
  77. text/plain \
  78. text/x-component \
  79. text/xml
  80. </IfModule>
  81. </IfModule>
  82. # caching:
  83. # --------------------------------------------------------------------------------------------------------------------------
  84. # these expires are reasonbly quick, to reflect the rapid nature of forums
  85. <IfModule mod_expires.c>
  86. ExpiresActive on
  87. ExpiresDefault "access plus 1 day"
  88. ExpiresByType text/html "access plus 0 seconds"
  89. ExpiresByType text/css "access plus 1 day"
  90. ExpiresByType application/javascript "access plus 1 day"
  91. ExpiresByType text/xml "access plus 0 seconds"
  92. ExpiresByType application/xml "access plus 1 hour"
  93. ExpiresByType application/rss+xml "access plus 1 hour"
  94. ExpiresByType image/x-icon "access plus 1 week"
  95. ExpiresByType image/gif "access plus 1 week"
  96. ExpiresByType image/png "access plus 1 week"
  97. ExpiresByType image/jpeg "access plus 1 week"
  98. ExpiresByType application/x-font-ttf "access plus 1 week"
  99. ExpiresByType font/opentype "access plus 1 week"
  100. ExpiresByType application/x-font-woff "access plus 1 week"
  101. ExpiresByType image/svg+xml "access plus 1 week"
  102. ExpiresByType application/vnd.ms-fontobject "access plus 1 week"
  103. </IfModule>
  104. # `FileETag None` is not enough for every server.
  105. <IfModule mod_headers.c>
  106. Header unset ETag
  107. </IfModule>
  108. # Since we're sending far-future expires, we don't need ETags for static content
  109. # <developer.yahoo.com/performance/rules.html#etags>
  110. FileETag None
  111. # rewrite rules:
  112. # --------------------------------------------------------------------------------------------------------------------------
  113. <IfModule mod_rewrite.c>
  114. RewriteEngine On
  115. # NNF will display an error message if .htaccess is missing, or not enabled;
  116. # we detect that by this environment variable failing to carry through
  117. RewriteRule .* - [E=HTTP_HTACCESS:1]
  118. # HTTP_AUTH workaround for CGI:
  119. # <orangejuiceliberationfront.com/http-auth-with-php-in-cgi-mode-e-g-on-dreamhost/>
  120. RewriteRule .* - [E=HTTP_AUTHORIZATION:%{HTTP:Authorization}]
  121. # custom favicon?
  122. RewriteCond %{DOCUMENT_ROOT}/favicon\.ico !-f
  123. RewriteRule ^favicon\.ico$ favicon.default.ico [NC,L]
  124. # custom apple-touch-icon?
  125. RewriteCond %{DOCUMENT_ROOT}/apple-touch-icon\.png !-f
  126. RewriteRule ^apple-touch-icon\.png$ apple-touch-icon.default.png [NC,L]
  127. RewriteCond %{DOCUMENT_ROOT}/apple-touch-icon-precomposed\.png !-f
  128. RewriteRule ^apple-touch-icon-precomposed\.png$ apple-touch-icon.default.png [NC,L]
  129. # custom windows tile icon?
  130. RewriteCond %{DOCUMENT_ROOT}/metro-tile\.png !-f
  131. RewriteRule ^metro-tile\.png$ metro-tile.default.png [NC,L]
  132. # don’t allow any access to '/users' (this is accessed purely from the PHP)
  133. RewriteRule ^users/.*$ - [NC,F]
  134. # don’t allow forum access to users / themes / lib folder
  135. RewriteCond %{QUERY_STRING} path=(?:themes|users|lib) [NC]
  136. RewriteRule ^ - [F]
  137. # page numbers on the root forum
  138. RewriteRule ^[:+](\d+)$ ?page=$1 [QSA,L]
  139. # a thread
  140. RewriteCond %{REQUEST_URI} ^(/(?:[^\./&]+/)*[_a-z0-9-]+)(?:[:+]\d+)?$
  141. RewriteCond %{DOCUMENT_ROOT}%1.rss -f
  142. RewriteRule ^((?:[^\./&]+/)*)([_a-z0-9-]+)(?:[:+](\d+))?$ thread.php?path=$1&file=$2&page=$3 [QSA,L]
  143. # a sub-forum
  144. RewriteCond %{REQUEST_URI} ^(/(?:[^\./&]+/)+)(?:[:+]\d+)?$
  145. RewriteCond %{DOCUMENT_ROOT}%1 -d
  146. RewriteRule ^((?:[^\./&]+/)+)(?:[:+](\d+))?$ index.php?path=$1&page=$2 [QSA,L]
  147. </IfModule>