From bb3a42627b1410509490b4f0949722eaa4fe315e Mon Sep 17 00:00:00 2001 From: Matt Birkholz Date: Mon, 11 Mar 2024 17:30:52 -0500 Subject: [PATCH] Shorten //gitweb.cgi/path URLs to //git/path. --- README.org | 15 +++++++-------- roles_t/abbey-core/tasks/main.yml | 24 ++++++++++++------------ roles_t/abbey-front/tasks/main.yml | 8 ++++---- 3 files changed, 23 insertions(+), 24 deletions(-) diff --git a/README.org b/README.org index e7c50d7..97034ec 100644 --- a/README.org +++ b/README.org @@ -270,12 +270,11 @@ Apache configurations. Like the suggested per-user rewrite rule in the ~gitweb(1)~ manual page, the second ~RewriteRule~ specifies the root directory of the user's public Git repositories via the ~GITWEB_PROJECTROOT~ -environment variable. It makes ~http://www/~dick/gitweb.cgi~ run +environment variable. It makes ~http://www/~dick/git~ run Gitweb with the project root =~dick/Public/Git/=, the same directory the ~git-daemon~ makes available. The first ~RewriteRule~ directs -URLs with no user name to the default. Thus ~http://www/gitweb.cgi~ -lists the repositories found in =/var/www/git/=. The match patterns -of both rules recognize =/gitweb= as well as =/gitweb.cgi=. +URLs with no user name to the default. Thus ~http://www/git~ +lists the repositories found in =/var/www/git/=. #+NAME: apache-gitweb #+CAPTION: ~apache-gitweb~ @@ -286,10 +285,10 @@ Alias /gitweb-static/ /usr/share/gitweb/static/ Options MultiViews RewriteEngine on -RewriteRule ^/gitweb(\.cgi)?(/.*)?$ \ - /cgi-bin/gitweb.cgi$2 [QSA,L,PT] -RewriteRule ^/\~([^\/]+)/gitweb(\.cgi)?(/.*)?$ \ - /cgi-bin/gitweb.cgi$3 \ +RewriteRule ^/git(/.*)?$ \ + /cgi-bin/gitweb.cgi$1 [QSA,L,PT] +RewriteRule ^/\~([^\/]+)/git(/.*)?$ \ + /cgi-bin/gitweb.cgi$2 \ [QSA,E=GITWEB_PROJECTROOT:/home/$1/Public/Git/,L,PT] #+END_SRC diff --git a/roles_t/abbey-core/tasks/main.yml b/roles_t/abbey-core/tasks/main.yml index 7e64635..a624ee4 100644 --- a/roles_t/abbey-core/tasks/main.yml +++ b/roles_t/abbey-core/tasks/main.yml @@ -72,10 +72,10 @@ Options MultiViews RewriteEngine on - RewriteRule ^/gitweb(\.cgi)?(/.*)?$ \ - /cgi-bin/gitweb.cgi$2 [QSA,L,PT] - RewriteRule ^/\~([^\/]+)/gitweb(\.cgi)?(/.*)?$ \ - /cgi-bin/gitweb.cgi$3 \ + RewriteRule ^/git(/.*)?$ \ + /cgi-bin/gitweb.cgi$1 [QSA,L,PT] + RewriteRule ^/\~([^\/]+)/git(/.*)?$ \ + /cgi-bin/gitweb.cgi$2 \ [QSA,E=GITWEB_PROJECTROOT:/home/$1/Public/Git/,L,PT] dest: /etc/apache2/sites-available/live-vhost.conf mode: u=rw,g=r,o=r @@ -106,10 +106,10 @@ Options MultiViews RewriteEngine on - RewriteRule ^/gitweb(\.cgi)?(/.*)?$ \ - /cgi-bin/gitweb.cgi$2 [QSA,L,PT] - RewriteRule ^/\~([^\/]+)/gitweb(\.cgi)?(/.*)?$ \ - /cgi-bin/gitweb.cgi$3 \ + RewriteRule ^/git(/.*)?$ \ + /cgi-bin/gitweb.cgi$1 [QSA,L,PT] + RewriteRule ^/\~([^\/]+)/git(/.*)?$ \ + /cgi-bin/gitweb.cgi$2 \ [QSA,E=GITWEB_PROJECTROOT:/home/$1/Public/Git/,L,PT] dest: /etc/apache2/sites-available/test-vhost.conf mode: u=rw,g=r,o=r @@ -170,10 +170,10 @@ Options MultiViews RewriteEngine on - RewriteRule ^/gitweb(\.cgi)?(/.*)?$ \ - /cgi-bin/gitweb.cgi$2 [QSA,L,PT] - RewriteRule ^/\~([^\/]+)/gitweb(\.cgi)?(/.*)?$ \ - /cgi-bin/gitweb.cgi$3 \ + RewriteRule ^/git(/.*)?$ \ + /cgi-bin/gitweb.cgi$1 [QSA,L,PT] + RewriteRule ^/\~([^\/]+)/git(/.*)?$ \ + /cgi-bin/gitweb.cgi$2 \ [QSA,E=GITWEB_PROJECTROOT:/home/$1/Public/Git/,L,PT] dest: /etc/apache2/sites-available/www-vhost.conf mode: u=rw,g=r,o=r diff --git a/roles_t/abbey-front/tasks/main.yml b/roles_t/abbey-front/tasks/main.yml index d71f050..878e3e4 100644 --- a/roles_t/abbey-front/tasks/main.yml +++ b/roles_t/abbey-front/tasks/main.yml @@ -73,10 +73,10 @@ Options MultiViews RewriteEngine on - RewriteRule ^/gitweb(\.cgi)?(/.*)?$ \ - /cgi-bin/gitweb.cgi$2 [QSA,L,PT] - RewriteRule ^/\~([^\/]+)/gitweb(\.cgi)?(/.*)?$ \ - /cgi-bin/gitweb.cgi$3 \ + RewriteRule ^/git(/.*)?$ \ + /cgi-bin/gitweb.cgi$1 [QSA,L,PT] + RewriteRule ^/\~([^\/]+)/git(/.*)?$ \ + /cgi-bin/gitweb.cgi$2 \ [QSA,E=GITWEB_PROJECTROOT:/home/$1/Public/Git/,L,PT] IncludeOptional /etc/letsencrypt/options-ssl-apache.conf -- 2.25.1