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;