From 1e7300ad676d91717ef36a8eeee46763287c0ee2 Mon Sep 17 00:00:00 2001 From: Shea Levy Date: Thu, 27 Feb 2014 06:37:22 -0500 Subject: [PATCH] mediawiki rewrite rules only needed with no urlPrefix --- .../web-servers/apache-httpd/mediawiki.nix | 19 +++++++++++-------- 1 file changed, 11 insertions(+), 8 deletions(-) diff --git a/nixos/modules/services/web-servers/apache-httpd/mediawiki.nix b/nixos/modules/services/web-servers/apache-httpd/mediawiki.nix index 9f4189e4d499..29efc975a383 100644 --- a/nixos/modules/services/web-servers/apache-httpd/mediawiki.nix +++ b/nixos/modules/services/web-servers/apache-httpd/mediawiki.nix @@ -126,7 +126,17 @@ in ''} - ${optionalString (config.urlPrefix != "") "Alias ${config.urlPrefix} ${mediawikiRoot}"} + ${if config.urlPrefix != "" then "Alias ${config.urlPrefix} ${mediawikiRoot}" else '' + RewriteEngine On + RewriteCond %{DOCUMENT_ROOT}%{REQUEST_URI} !-f + RewriteCond %{DOCUMENT_ROOT}%{REQUEST_URI} !-d + RewriteRule ^(.*)$ %{DOCUMENT_ROOT}/${if config.articleUrlPrefix == "" + then "" + else "${config.articleUrlPrefix}/" + }index.php [L] + + RewriteRule ^/*$ ${mediawikiRoot}/index.php [L] # For syntax hilighter: */ + ''} Order allow,deny @@ -137,13 +147,6 @@ in ${optionalString (config.articleUrlPrefix != "") '' Alias ${config.articleUrlPrefix} ${mediawikiRoot}/index.php ''} - - RewriteEngine On - RewriteCond ${mediawikiRoot}/$0 !-f - RewriteCond ${mediawikiRoot}/$0 !-d - RewriteRule ^(.*)$ ${mediawikiRoot}/index.php [L] - - RewriteRule ^/*$ ${mediawikiRoot}/index.php [L] # For syntax hilighter: */ ''; documentRoot = if config.urlPrefix == "" then mediawikiRoot else null;