arsava / dokuwiki-template-vector

"vector" brings you the MediaWiki/Wikipedia 2010 look and feel for DokuWiki.
http://www.dokuwiki.org/template:vector
GNU General Public License v2.0
38 stars 9 forks source link

Error in .htaccess file when using Apache 2.4 #63

Open codeaddicted opened 5 years ago

codeaddicted commented 5 years ago

In apache 2.4 the Permission system drastically changed (see https://httpd.apache.org/docs/2.4/upgrading.html) the delivered .htaccess file in the vector template only works with apache 2.2.

See the below patch for a version working with both apache 2.2 and 2.4

--- .htaccess.old       2018-08-10 09:47:06.359821000 +0200
+++ .htaccess   2018-08-10 09:49:56.751821000 +0200
@@ -4,11 +4,25 @@
 #      The reason for protecting these files is to to keep searchengines/foo
 #      away from indexing files containing version information, names and/or not
 #      necessarily public template parts by default.
-<FilesMatch "^inc_(detail|cite)\.php$">
-  Order Deny,Allow
-  Deny from all
-</FilesMatch>
-<FilesMatch "^(README|README-de|COPYING|ChangeLog|CREDITS|VERSION|style\.ini|template\.info\.txt|detail\.php|main\.php|mediamanager\.php)$">
-  Order Deny,Allow
-  Deny from all
-</FilesMatch>
+
+# Apache 2.2
+<IfModule !mod_authz_core.c>
+  <FilesMatch "^inc_(detail|cite)\.php$">
+    Order Deny,Allow
+    Deny from all
+  </FilesMatch>
+  <FilesMatch "^(README|README-de|COPYING|ChangeLog|CREDITS|VERSION|style\.ini|template\.info\.txt|detail\.php|main\.php|mediamanager\.php)$">
+    Order Deny,Allow
+    Deny from all
+  </FilesMatch>
+</IfModule>
+
+# Apache 2.4
+<IfModule mod_authz_core.c>
+  <FilesMatch "^inc_(detail|cite)\.php$">
+    Require all denied
+  </FilesMatch>
+  <FilesMatch "^(README|README-de|COPYING|ChangeLog|CREDITS|VERSION|style\.ini|template\.info\.txt|detail\.php|main\.php|mediamanager\.php)$">
+    Require all denied
+  </FilesMatch>
+</IfModule>

Thanks for the awesome template!

-Codeaddicted