diff --git a/plinth/modules/gitweb/data/etc/apache2/conf-available/gitweb-freedombox.conf b/plinth/modules/gitweb/data/etc/apache2/conf-available/gitweb-freedombox.conf
index 726fd5820..16e1d6936 100644
--- a/plinth/modules/gitweb/data/etc/apache2/conf-available/gitweb-freedombox.conf
+++ b/plinth/modules/gitweb/data/etc/apache2/conf-available/gitweb-freedombox.conf
@@ -7,16 +7,6 @@
## mod_rewrite
##
-# Make gitweb work with custom FreedomBox configuration.
-SetEnv GITWEB_CONFIG /etc/gitweb-freedombox.conf
-
-# Configure git-http-backend to work with our repository path.
-SetEnv GIT_PROJECT_ROOT /var/lib/git
-
-# Tell git-http-backend to work with all the projects even when they don't have
-# the file 'git-daemon-export-ok'.
-SetEnv GIT_HTTP_EXPORT_ALL
-
# All git operations are handled by git-http-backend CGI script. Rest of the
# HTTP requests (say sent by the browser) are handled by gitweb.
ScriptAliasMatch \
@@ -31,6 +21,9 @@ ScriptAliasMatch \
Alias /gitweb /usr/share/gitweb
+ # Make gitweb work with custom FreedomBox configuration.
+ SetEnv GITWEB_CONFIG /etc/gitweb-freedombox.conf
+
Include includes/freedombox-single-sign-on.conf
@@ -53,6 +46,13 @@ Alias /gitweb /usr/share/gitweb
+ # Configure git-http-backend to work with our repository path.
+ SetEnv GIT_PROJECT_ROOT /var/lib/git
+
+ # Tell git-http-backend to work with all the projects even when they don't
+ # have the file 'git-daemon-export-ok'.
+ SetEnv GIT_HTTP_EXPORT_ALL
+
# Authentication is required when performing git push (git send-pack).
SetEnvIfExpr "%{QUERY_STRING} =~ /service=git-receive-pack/" AUTHREQUIRED
SetEnvIfExpr "%{REQUEST_URI} =~ /git-receive-pack$/" AUTHREQUIRED